@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,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const entranceProgress = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
|
|
9
|
-
(0, react_1.useEffect)(() => {
|
|
10
|
-
react_native_1.Animated.spring(entranceProgress, {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { Animated } from "react-native";
|
|
4
|
+
export const PopIn = ({ children, xOffset, yOffset, }) => {
|
|
5
|
+
const entranceProgress = useRef(new Animated.Value(0)).current;
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
Animated.spring(entranceProgress, {
|
|
11
8
|
toValue: 1,
|
|
12
9
|
bounciness: 12,
|
|
13
10
|
speed: 28,
|
|
14
11
|
useNativeDriver: true,
|
|
15
12
|
}).start();
|
|
16
13
|
}, []);
|
|
17
|
-
return ((
|
|
14
|
+
return (_jsx(Animated.View, { style: {
|
|
18
15
|
opacity: entranceProgress,
|
|
19
16
|
transform: [
|
|
20
17
|
{
|
|
@@ -42,4 +39,3 @@ const PopIn = ({ children, xOffset, yOffset, }) => {
|
|
|
42
39
|
],
|
|
43
40
|
}, children: children }));
|
|
44
41
|
};
|
|
45
|
-
exports.PopIn = PopIn;
|
|
@@ -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("./PopIn"), exports);
|
|
1
|
+
export * from "./PopIn";
|
|
@@ -1,33 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const svgs_1 = require("../../svgs");
|
|
14
|
-
const Flex_1 = require("../Flex");
|
|
15
|
-
const Touchable_1 = require("../Touchable");
|
|
16
|
-
const Popover = ({ variant = "dark", children, visible, onPressOutside, onDismiss, onCloseComplete, placement = "top", title, content, noCloseIcon, }) => {
|
|
17
|
-
const style = exports.POPOVER_VARIANTS[variant];
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)(react_native_popover_view_1.default, { backgroundStyle: { opacity: 0.5, backgroundColor: palette_tokens_1.THEME.colors.black100 }, popoverStyle: [{ backgroundColor: style.backgroundColor }, style.shadow], from: children, isVisible: visible,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { THEME } from "@artsy/palette-tokens";
|
|
3
|
+
import { Platform, StatusBar } from "react-native";
|
|
4
|
+
import RNPopover from "react-native-popover-view";
|
|
5
|
+
import { Easing } from "react-native-reanimated";
|
|
6
|
+
import styled from "styled-components";
|
|
7
|
+
import { CloseIcon } from "../../svgs";
|
|
8
|
+
import { Flex } from "../Flex";
|
|
9
|
+
import { Touchable } from "../Touchable";
|
|
10
|
+
export const Popover = ({ variant = "dark", children, visible, onPressOutside, onDismiss, onCloseComplete, placement = "top", title, content, noCloseIcon, }) => {
|
|
11
|
+
const style = POPOVER_VARIANTS[variant];
|
|
12
|
+
return (_jsx(RNPopover, { backgroundStyle: { opacity: 0.5, backgroundColor: THEME.colors.black100 }, popoverStyle: [{ backgroundColor: style.backgroundColor }, style.shadow], from: children, isVisible: visible,
|
|
19
13
|
// this is required to make sure that the popover is positioned correctly on android
|
|
20
|
-
verticalOffset:
|
|
14
|
+
verticalOffset: Platform.OS === "android" ? -(StatusBar.currentHeight ?? 0) : 0, onCloseComplete: onCloseComplete, onRequestClose: onPressOutside, placement: placement, arrowSize: { height: 11, width: 22 }, animationConfig: {
|
|
21
15
|
duration: 400,
|
|
22
|
-
easing:
|
|
23
|
-
}, children: (
|
|
16
|
+
easing: Easing.out(Easing.exp),
|
|
17
|
+
}, children: _jsxs(Container, { variant: variant, p: 1, children: [_jsxs(Flex, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", children: [title ? title : _jsx(Flex, {}), !noCloseIcon && (_jsx(Touchable, { onPress: onDismiss, accessibilityRole: "button", "aria-label": "Dismiss popover", children: _jsx(Flex, { ml: 0.5, children: _jsx(CloseIcon, { width: 18, height: 18, fill: style.fill }) }) }))] }), content] }) }));
|
|
24
18
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
background-color: ${({ variant }) => exports.POPOVER_VARIANTS[variant].backgroundColor};
|
|
19
|
+
const Container = styled(Flex) `
|
|
20
|
+
background-color: ${({ variant }) => POPOVER_VARIANTS[variant].backgroundColor};
|
|
28
21
|
`;
|
|
29
22
|
const DROP_SHADOW = {
|
|
30
|
-
shadowColor:
|
|
23
|
+
shadowColor: THEME.colors.black100,
|
|
31
24
|
shadowOffset: {
|
|
32
25
|
width: 0,
|
|
33
26
|
height: 2,
|
|
@@ -36,14 +29,14 @@ const DROP_SHADOW = {
|
|
|
36
29
|
shadowRadius: 2.62,
|
|
37
30
|
elevation: 4,
|
|
38
31
|
};
|
|
39
|
-
|
|
32
|
+
export const POPOVER_VARIANTS = {
|
|
40
33
|
light: {
|
|
41
|
-
backgroundColor:
|
|
34
|
+
backgroundColor: THEME.colors.white100,
|
|
42
35
|
fill: "black100",
|
|
43
36
|
shadow: DROP_SHADOW,
|
|
44
37
|
},
|
|
45
38
|
dark: {
|
|
46
|
-
backgroundColor:
|
|
39
|
+
backgroundColor: THEME.colors.black100,
|
|
47
40
|
fill: "white100",
|
|
48
41
|
},
|
|
49
42
|
};
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const Text_1 = require("../Text");
|
|
10
|
-
(0, react_native_1.storiesOf)("Popover", module)
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { storiesOf } from "@storybook/react-native";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Popover } from "./Popover";
|
|
5
|
+
import { Button } from "../Button";
|
|
6
|
+
import { Flex } from "../Flex";
|
|
7
|
+
import { Text } from "../Text";
|
|
8
|
+
storiesOf("Popover", module)
|
|
11
9
|
.add("Variants", () => {
|
|
12
|
-
const [visible, setVisible] =
|
|
13
|
-
return ((
|
|
10
|
+
const [visible, setVisible] = useState(null);
|
|
11
|
+
return (_jsxs(Flex, { flex: 1, alignSelf: "center", mt: 12, alignItems: "center", flexWrap: "wrap", children: [_jsx(Popover, { visible: visible === "top-dark", title: _jsx(Text, { color: "white100", variant: "xs", children: "Popover Top Dark" }), onPressOutside: () => setVisible(null), onDismiss: () => setVisible(null), children: _jsx(Text, { onPress: () => setVisible("top-dark"), children: "Top Dark" }) }), _jsx(Popover, { visible: visible === "bottom-dark", placement: "bottom", title: _jsx(Text, { color: "white100", variant: "xs", children: "Popover Bottom Dark" }), onPressOutside: () => setVisible(null), onDismiss: () => setVisible(null), children: _jsx(Text, { onPress: () => setVisible("bottom-dark"), children: "Bottom Dark" }) }), _jsx(Popover, { visible: visible === "top-light", placement: "top", variant: "light", title: _jsx(Text, { variant: "xs", children: "Popover Top Light" }), onPressOutside: () => setVisible(null), onDismiss: () => setVisible(null), children: _jsx(Text, { onPress: () => setVisible("top-light"), children: "Top Light" }) }), _jsx(Popover, { visible: visible === "bottom-light", placement: "bottom", variant: "light", title: _jsx(Text, { variant: "xs", children: "Popover Bottom Light" }), onPressOutside: () => setVisible(null), onDismiss: () => setVisible(null), children: _jsx(Text, { onPress: () => setVisible("bottom-light"), children: "Bottom Light" }) })] }));
|
|
14
12
|
})
|
|
15
13
|
.add("With title and/or content", () => {
|
|
16
|
-
const [visible, setVisible] =
|
|
17
|
-
return ((
|
|
14
|
+
const [visible, setVisible] = useState(null);
|
|
15
|
+
return (_jsxs(Flex, { flex: 1, alignSelf: "center", mt: 12, alignItems: "center", flexWrap: "wrap", children: [_jsx(Popover, { visible: visible === "title", title: _jsx(Text, { weight: "medium", color: "white100", children: "Popover title" }), content: _jsxs(_Fragment, { children: [_jsx(Text, { color: "white100", children: "Popover descriptive text with some not so long long long body" }), _jsx(Text, { color: "white100", children: "And some line break" })] }), onDismiss: () => setVisible(null), children: _jsx(Text, { onPress: () => setVisible("title"), children: "Some title and description" }) }), _jsx(Popover, { visible: visible === "buttons", placement: "bottom", variant: "light", content: _jsxs(_Fragment, { children: [_jsx(Text, { weight: "medium", mb: 1, children: "Popover title" }), _jsx(Flex, { height: 80, backgroundColor: "black30", mb: 1 }), _jsx(Text, { mb: 1, children: "Popover descriptive text" }), _jsxs(Flex, { flexDirection: "row", justifyContent: "flex-end", children: [_jsx(Button, { size: "small", variant: "outlineGray", children: "Learn more" }), _jsx(Button, { size: "small", ml: 1, onPress: () => setVisible(null), children: "Got it" })] })] }), onDismiss: () => setVisible(null), children: _jsx(Text, { onPress: () => setVisible("buttons"), children: "Buttons and more content" }) }), _jsx(Popover, { visible: visible === "no-close", placement: "bottom", noCloseIcon: true, variant: "light", content: _jsxs(_Fragment, { children: [_jsx(Text, { weight: "medium", mb: 1, children: "Popover title?" }), _jsx(Flex, { height: 80, backgroundColor: "black30", mb: 1 }), _jsx(Text, { mb: 1, children: "Popover descriptive text" }), _jsx(Button, { size: "small", onPress: () => setVisible(null), children: "Got it" })] }), onDismiss: () => setVisible(null), children: _jsx(Text, { onPress: () => setVisible("no-close"), children: "Content without close icon" }) })] }));
|
|
18
16
|
})
|
|
19
17
|
.add("Edge positions", () => {
|
|
20
|
-
const [topVisible, setTopVisible] =
|
|
21
|
-
const [bottomVisible, setBottomVisible] =
|
|
22
|
-
return ((
|
|
18
|
+
const [topVisible, setTopVisible] = useState(true);
|
|
19
|
+
const [bottomVisible, setBottomVisible] = useState(false);
|
|
20
|
+
return (_jsxs(Flex, { flex: 1, backgroundColor: "black30", justifyContent: "space-between", px: 1, children: [_jsx(Flex, { backgroundColor: "white100", width: 80, px: 1, children: _jsx(Popover, { visible: topVisible, placement: "bottom", onDismiss: () => setTopVisible(false), onCloseComplete: () => setBottomVisible(true), title: _jsx(Text, { color: "white100", variant: "xs", children: "Top-Left" }), children: _jsx(Text, { children: "Top-left" }) }) }), _jsx(Flex, { backgroundColor: "white100", width: 120, mb: 6, alignSelf: "flex-end", px: 1, children: _jsx(Popover, { visible: bottomVisible, onDismiss: () => setBottomVisible(false), title: _jsx(Text, { color: "white100", variant: "xs", children: "Bottom-Right" }), children: _jsx(Text, { children: "Bottom-right" }) }) })] }));
|
|
23
21
|
});
|
|
@@ -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("./Popover"), exports);
|
|
1
|
+
export * from "./Popover";
|
|
@@ -1,56 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 __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.ProgressBar = void 0;
|
|
27
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
-
const react_1 = require("react");
|
|
29
|
-
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
30
|
-
const hooks_1 = require("../../utils/hooks");
|
|
31
|
-
const useColor_1 = require("../../utils/hooks/useColor");
|
|
32
|
-
const Flex_1 = require("../Flex");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
4
|
+
import { useSpace } from "../../utils/hooks";
|
|
5
|
+
import { useColor } from "../../utils/hooks/useColor";
|
|
6
|
+
import { Flex } from "../Flex";
|
|
33
7
|
const clamp = (num, min, max) => Math.max(min, Math.min(num, max));
|
|
34
|
-
const ProgressBar = ({ animationDuration = 200, backgroundColor = "black30", height = 2, onCompletion, progress: unclampedProgress, trackColor = "blue100", style, progressBarStyle, }) => {
|
|
35
|
-
const color =
|
|
36
|
-
const space =
|
|
37
|
-
const width =
|
|
8
|
+
export const ProgressBar = ({ animationDuration = 200, backgroundColor = "black30", height = 2, onCompletion, progress: unclampedProgress, trackColor = "blue100", style, progressBarStyle, }) => {
|
|
9
|
+
const color = useColor();
|
|
10
|
+
const space = useSpace();
|
|
11
|
+
const width = useSharedValue(0);
|
|
38
12
|
const progress = clamp(unclampedProgress, 0, 100);
|
|
39
|
-
const progressAnim =
|
|
13
|
+
const progressAnim = useAnimatedStyle(() => {
|
|
40
14
|
return { width: `${width.value}%` };
|
|
41
15
|
});
|
|
42
|
-
const [onCompletionCalled, setOnCompletionCalled] =
|
|
43
|
-
|
|
44
|
-
width.value =
|
|
16
|
+
const [onCompletionCalled, setOnCompletionCalled] = useState(false);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
width.value = withTiming(progress, { duration: animationDuration });
|
|
45
19
|
if (progress === 100 && !onCompletionCalled) {
|
|
46
20
|
onCompletion?.();
|
|
47
21
|
setOnCompletionCalled(true);
|
|
48
22
|
}
|
|
49
23
|
}, [progress]);
|
|
50
|
-
return ((
|
|
24
|
+
return (_jsx(Flex, { width: "10%", backgroundColor: backgroundColor, style: {
|
|
51
25
|
marginVertical: space(1),
|
|
52
26
|
width: "100%",
|
|
53
27
|
...style,
|
|
54
|
-
}, children: (
|
|
28
|
+
}, children: _jsx(Animated.View, { testID: "progress-bar-track", style: [progressAnim, { height, backgroundColor: color(trackColor) }, progressBarStyle] }) }));
|
|
55
29
|
};
|
|
56
|
-
exports.ProgressBar = ProgressBar;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const Text_1 = require("../Text");
|
|
8
|
-
(0, react_native_1.storiesOf)("Progress Indicators", module).add("ProgressBar", () => ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { p: 2, children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { children: "10%" }), (0, jsx_runtime_1.jsx)(_1.ProgressBar, { progress: 10 }), (0, jsx_runtime_1.jsx)(Text_1.Text, { children: "20%" }), (0, jsx_runtime_1.jsx)(_1.ProgressBar, { progress: 20 }), (0, jsx_runtime_1.jsx)(Text_1.Text, { children: "50%" }), (0, jsx_runtime_1.jsx)(_1.ProgressBar, { progress: 50 })] })));
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { storiesOf } from "@storybook/react-native";
|
|
3
|
+
import { ProgressBar } from "./";
|
|
4
|
+
import { Flex } from "../Flex";
|
|
5
|
+
import { Text } from "../Text";
|
|
6
|
+
storiesOf("Progress Indicators", module).add("ProgressBar", () => (_jsxs(Flex, { p: 2, children: [_jsx(Text, { children: "10%" }), _jsx(ProgressBar, { progress: 10 }), _jsx(Text, { children: "20%" }), _jsx(ProgressBar, { progress: 20 }), _jsx(Text, { children: "50%" }), _jsx(ProgressBar, { progress: 50 })] })));
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const ProgressBar_1 = require("./ProgressBar");
|
|
6
|
-
const renderWithWrappers_1 = require("../../utils/tests/renderWithWrappers");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { waitFor } from "@testing-library/react-native";
|
|
3
|
+
import { ProgressBar } from "./ProgressBar";
|
|
4
|
+
import { renderWithWrappers } from "../../utils/tests/renderWithWrappers";
|
|
7
5
|
describe("ProgressBar", () => {
|
|
8
6
|
const getWrapper = (props) => {
|
|
9
|
-
return
|
|
7
|
+
return renderWithWrappers(_jsx(ProgressBar, { ...props }));
|
|
10
8
|
};
|
|
11
9
|
it.skip("does not display the track view when progress is zero", async () => {
|
|
12
10
|
const wrapper = getWrapper({ progress: 0 });
|
|
@@ -14,7 +12,7 @@ describe("ProgressBar", () => {
|
|
|
14
12
|
const track = wrapper.getByTestId("progress-bar-track");
|
|
15
13
|
expect(container.props.width).toEqual("100%");
|
|
16
14
|
// width of 0% is invisible
|
|
17
|
-
await
|
|
15
|
+
await waitFor(() => expect(track.props.style.width).toEqual("0%"));
|
|
18
16
|
});
|
|
19
17
|
it.skip("display the track view when progress is above zero", async () => {
|
|
20
18
|
const wrapper = getWrapper({ progress: 50 });
|
|
@@ -23,6 +21,6 @@ describe("ProgressBar", () => {
|
|
|
23
21
|
expect(container.props.width).toEqual("100%");
|
|
24
22
|
// width of 50% is visible
|
|
25
23
|
// wait for animations to finish running
|
|
26
|
-
await
|
|
24
|
+
await waitFor(() => expect(track.props.style.width).toEqual("50%"));
|
|
27
25
|
});
|
|
28
26
|
});
|
|
@@ -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("./ProgressBar"), exports);
|
|
1
|
+
export * from "./ProgressBar";
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const react_native_1 = require("react-native");
|
|
10
|
-
const native_1 = __importDefault(require("styled-components/native"));
|
|
11
|
-
const animation_1 = require("../../animation");
|
|
12
|
-
const useTheme_1 = require("../../utils/hooks/useTheme");
|
|
13
|
-
const Flex_1 = require("../Flex");
|
|
14
|
-
const Text_1 = require("../Text");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { themeGet } from "@styled-system/theme-get";
|
|
3
|
+
import { PixelRatio, StyleSheet, TouchableWithoutFeedback, View, } from "react-native";
|
|
4
|
+
import styled from "styled-components/native";
|
|
5
|
+
import { CssTransition } from "../../animation";
|
|
6
|
+
import { useTheme } from "../../utils/hooks/useTheme";
|
|
7
|
+
import { Flex } from "../Flex";
|
|
8
|
+
import { Text } from "../Text";
|
|
15
9
|
const RADIOBUTTON_SIZE = 20;
|
|
16
10
|
const DURATION = 150;
|
|
17
|
-
const RadioButton = ({ selected, disabled, error, onPress, text, textVariant = "md", subtitle, accessibilityState, ...restProps }) => {
|
|
18
|
-
const { color, space } =
|
|
19
|
-
const fontScale =
|
|
11
|
+
export const RadioButton = ({ selected, disabled, error, onPress, text, textVariant = "md", subtitle, accessibilityState, ...restProps }) => {
|
|
12
|
+
const { color, space } = useTheme();
|
|
13
|
+
const fontScale = PixelRatio.getFontScale();
|
|
20
14
|
const radioButtonSize = RADIOBUTTON_SIZE * fontScale;
|
|
21
15
|
const defaultRadioButtonStyle = {
|
|
22
16
|
backgroundColor: color("white100"),
|
|
@@ -45,21 +39,20 @@ const RadioButton = ({ selected, disabled, error, onPress, text, textVariant = "
|
|
|
45
39
|
: radioButtonStyles[error ? "error" : "default"][selected ? "selected" : "notSelected"];
|
|
46
40
|
const textColor = error ? color("red100") : disabled ? color("black30") : color("black100");
|
|
47
41
|
const subtitleColor = error ? color("red100") : color("black30");
|
|
48
|
-
return ((
|
|
42
|
+
return (_jsx(TouchableWithoutFeedback, { accessibilityState: accessibilityState, onPress: (event) => {
|
|
49
43
|
if (disabled) {
|
|
50
44
|
return;
|
|
51
45
|
}
|
|
52
46
|
onPress?.(event);
|
|
53
|
-
}, children: (
|
|
47
|
+
}, children: _jsxs(Flex, { ...restProps, children: [_jsxs(Flex, { flexDirection: "row", alignItems: "center", children: [_jsx(Flex, { mt: "2px", children: _jsx(CssTransition, { style: [
|
|
54
48
|
styles(fontScale).container,
|
|
55
49
|
{ marginRight: space(1) * fontScale },
|
|
56
50
|
radioButtonStyle,
|
|
57
51
|
], animate: ["borderColor"], duration: DURATION, children: !!selected &&
|
|
58
|
-
(!!disabled ? ((
|
|
52
|
+
(!!disabled ? (_jsx(DisabledDot, { size: radioButtonSize })) : (_jsx(RadioDot, { size: radioButtonSize }))) }) }), _jsx(Flex, { justifyContent: "center", children: !!text && (_jsx(Text, { variant: textVariant, color: textColor, children: text })) })] }), _jsx(Flex, { ml: `${(RADIOBUTTON_SIZE + space(1)) * fontScale}px`, mt: "6px", children: !!subtitle && (_jsx(Text, { variant: "xs", color: subtitleColor, children: subtitle })) })] }) }));
|
|
59
53
|
};
|
|
60
|
-
exports.RadioButton = RadioButton;
|
|
61
54
|
// styled-component does not have support for Animated.View
|
|
62
|
-
const styles = (fontScale) =>
|
|
55
|
+
const styles = (fontScale) => StyleSheet.create({
|
|
63
56
|
container: {
|
|
64
57
|
display: "flex",
|
|
65
58
|
justifyContent: "center",
|
|
@@ -74,16 +67,15 @@ const styles = (fontScale) => react_native_1.StyleSheet.create({
|
|
|
74
67
|
// This component represents the white ● mark in CSS. We are not using styled-system since it's easier to specify raw CSS
|
|
75
68
|
// properties with styled-component.
|
|
76
69
|
// Height, Width, and Border Radius calculations are used to maintain the size of the white dot when scaling
|
|
77
|
-
const RadioDot = ({ size }) => {
|
|
78
|
-
return ((
|
|
70
|
+
export const RadioDot = ({ size }) => {
|
|
71
|
+
return (_jsx(View, { style: {
|
|
79
72
|
height: size * 0.625,
|
|
80
73
|
width: size * 0.625,
|
|
81
74
|
borderRadius: size * 0.3125,
|
|
82
75
|
backgroundColor: "white",
|
|
83
76
|
} }));
|
|
84
77
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
border-
|
|
88
|
-
border-left-color: ${(0, theme_get_1.themeGet)("colors.black30")};
|
|
78
|
+
export const DisabledDot = styled(RadioDot) `
|
|
79
|
+
border-bottom-color: ${themeGet("colors.black30")};
|
|
80
|
+
border-left-color: ${themeGet("colors.black30")};
|
|
89
81
|
`;
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const Flex_1 = require("../Flex");
|
|
9
|
-
exports.default = {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { storiesOf } from "@storybook/react-native";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { RadioButton } from "./RadioButton";
|
|
5
|
+
import { List } from "../../storybook/helpers";
|
|
6
|
+
import { Flex } from "../Flex";
|
|
7
|
+
export default {
|
|
10
8
|
title: "RadioButton",
|
|
11
|
-
component:
|
|
9
|
+
component: RadioButton,
|
|
12
10
|
};
|
|
13
|
-
|
|
14
|
-
const [metric, setMetric] =
|
|
15
|
-
return ((
|
|
11
|
+
storiesOf("RadioButton", module).add("Default", () => {
|
|
12
|
+
const [metric, setMetric] = useState("cm");
|
|
13
|
+
return (_jsx(List, { contentContainerStyle: {
|
|
16
14
|
marginHorizontal: 20,
|
|
17
15
|
justifyContent: "flex-start",
|
|
18
16
|
alignItems: "flex-start",
|
|
19
|
-
}, children: (
|
|
17
|
+
}, children: _jsxs(Flex, { flexDirection: "row", gap: 20, children: [_jsx(RadioButton, { onPress: () => {
|
|
20
18
|
setMetric("cm");
|
|
21
|
-
}, selected: metric === "cm", text: "centimeters" }), (
|
|
19
|
+
}, selected: metric === "cm", text: "centimeters" }), _jsx(RadioButton, { onPress: () => {
|
|
22
20
|
setMetric("in");
|
|
23
21
|
}, selected: metric === "in", text: "inches" })] }) }));
|
|
24
22
|
});
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const Flex_1 = require("../Flex");
|
|
6
|
-
exports.RADIO_DOT_MODES = {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Flex } from "../Flex";
|
|
3
|
+
export const RADIO_DOT_MODES = {
|
|
7
4
|
default: {
|
|
8
5
|
resting: {
|
|
9
6
|
borderWidth: 2,
|
|
@@ -51,22 +48,21 @@ exports.RADIO_DOT_MODES = {
|
|
|
51
48
|
},
|
|
52
49
|
},
|
|
53
50
|
};
|
|
54
|
-
const RadioDot = (props) => ((
|
|
55
|
-
exports.RadioDot = RadioDot;
|
|
51
|
+
export const RadioDot = (props) => (_jsx(Container, { ...props, children: _jsx(Dot, { ...props }) }));
|
|
56
52
|
const Container = ({ selected = false, hover = false, error = false, disabled = false, }) => {
|
|
57
53
|
const mode = (() => {
|
|
58
54
|
switch (true) {
|
|
59
55
|
case disabled:
|
|
60
|
-
return
|
|
56
|
+
return RADIO_DOT_MODES.disabled;
|
|
61
57
|
case hover:
|
|
62
|
-
return
|
|
58
|
+
return RADIO_DOT_MODES.hover;
|
|
63
59
|
case error:
|
|
64
|
-
return
|
|
60
|
+
return RADIO_DOT_MODES.error;
|
|
65
61
|
default:
|
|
66
|
-
return
|
|
62
|
+
return RADIO_DOT_MODES.default;
|
|
67
63
|
}
|
|
68
64
|
})();
|
|
69
65
|
const moreProps = selected ? mode.selected : mode.resting;
|
|
70
|
-
return ((
|
|
66
|
+
return (_jsx(Flex, { width: 20, height: 20, borderRadius: 50, alignItems: "center", justifyContent: "center", flexShrink: 0, ...moreProps }));
|
|
71
67
|
};
|
|
72
|
-
const Dot = ({ selected = false, disabled = false }) => ((
|
|
68
|
+
const Dot = ({ selected = false, disabled = false }) => (_jsx(Flex, { width: 10, height: 10, borderRadius: 50, alignItems: "center", justifyContent: "center", flexShrink: 0, backgroundColor: disabled && !selected ? "transparent" : "white100" }));
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.RadioDot = exports.RadioButton = void 0;
|
|
4
|
-
var RadioButton_1 = require("./RadioButton");
|
|
5
|
-
Object.defineProperty(exports, "RadioButton", { enumerable: true, get: function () { return RadioButton_1.RadioButton; } });
|
|
6
|
-
var RadioDot_1 = require("./RadioDot");
|
|
7
|
-
Object.defineProperty(exports, "RadioDot", { enumerable: true, get: function () { return RadioDot_1.RadioDot; } });
|
|
1
|
+
export { RadioButton } from "./RadioButton";
|
|
2
|
+
export { RadioDot } from "./RadioDot";
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const Flex_1 = require("../Flex");
|
|
6
|
-
const Background = ({ children }) => ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { position: "absolute", top: 0, bottom: 0, left: 0, right: 0, children: children }));
|
|
7
|
-
exports.Background = Background;
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Flex } from "../Flex";
|
|
3
|
+
export const Background = ({ children }) => (_jsx(Flex, { position: "absolute", top: 0, bottom: 0, left: 0, right: 0, children: children }));
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const Body = ({ children, fullwidth, scroll, disableKeyboardAvoidance = false, ...flexProps }) => {
|
|
10
|
-
const Wrapper = disableKeyboardAvoidance ? react_1.Fragment : react_native_1.KeyboardAvoidingView;
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)(Wrapper, { ...(disableKeyboardAvoidance
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from "react";
|
|
3
|
+
import { KeyboardAvoidingView, Platform, ScrollView } from "react-native";
|
|
4
|
+
import { SCREEN_HORIZONTAL_PADDING } from "./constants";
|
|
5
|
+
import { Flex } from "../Flex";
|
|
6
|
+
export const Body = ({ children, fullwidth, scroll, disableKeyboardAvoidance = false, ...flexProps }) => {
|
|
7
|
+
const Wrapper = disableKeyboardAvoidance ? Fragment : KeyboardAvoidingView;
|
|
8
|
+
return (_jsx(Wrapper, { ...(disableKeyboardAvoidance
|
|
12
9
|
? {}
|
|
13
|
-
: { style: { flex: 1 }, behavior:
|
|
10
|
+
: { style: { flex: 1 }, behavior: Platform.OS === "ios" ? "padding" : "height" }), children: _jsx(Flex, { flex: 1, ...flexProps, children: _jsx(Flex, { flex: 1, px: fullwidth ? undefined : SCREEN_HORIZONTAL_PADDING, children: scroll ? _jsx(ScrollView, { children: children }) : children }) }) }));
|
|
14
11
|
};
|
|
15
|
-
exports.Body = Body;
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const constants_1 = require("./constants");
|
|
10
|
-
const useColor_1 = require("../../utils/hooks/useColor");
|
|
11
|
-
const Flex_1 = require("../Flex");
|
|
12
|
-
const BottomView = ({ children, darkMode }) => {
|
|
13
|
-
const color = (0, useColor_1.useColor)();
|
|
14
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_native_linear_gradient_1.default, { colors: [darkMode ? "rgba(0,0,0,0)" : "rgba(255,255,255,0)", color("background")], start: { x: 0, y: 0 }, end: { x: 0, y: 1 }, style: {
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import LinearGradient from "react-native-linear-gradient";
|
|
3
|
+
import { SCREEN_HORIZONTAL_PADDING } from "./constants";
|
|
4
|
+
import { useColor } from "../../utils/hooks/useColor";
|
|
5
|
+
import { Flex } from "../Flex";
|
|
6
|
+
export const BottomView = ({ children, darkMode }) => {
|
|
7
|
+
const color = useColor();
|
|
8
|
+
return (_jsxs(_Fragment, { children: [_jsx(LinearGradient, { colors: [darkMode ? "rgba(0,0,0,0)" : "rgba(255,255,255,0)", color("background")], start: { x: 0, y: 0 }, end: { x: 0, y: 1 }, style: {
|
|
15
9
|
width: "100%",
|
|
16
10
|
height: 20,
|
|
17
|
-
}, pointerEvents: "none" }), (
|
|
11
|
+
}, pointerEvents: "none" }), _jsx(Flex, { px: SCREEN_HORIZONTAL_PADDING, pt: 1, pb: 4, backgroundColor: "background", children: children })] }));
|
|
18
12
|
};
|
|
19
|
-
exports.BottomView = BottomView;
|