@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,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const useTheme_1 = require("../../utils/hooks/useTheme");
|
|
5
|
-
const useFontFamilyFor = ({ italic, weight, }) => {
|
|
6
|
-
const { theme } = (0, useTheme_1.useTheme)();
|
|
1
|
+
import { useTheme } from "../../utils/hooks/useTheme";
|
|
2
|
+
export const useFontFamilyFor = ({ italic, weight, }) => {
|
|
3
|
+
const { theme } = useTheme();
|
|
7
4
|
const { fonts } = theme;
|
|
8
5
|
if (italic && weight === "medium") {
|
|
9
6
|
return fonts.sans.mediumItalic;
|
|
@@ -16,19 +13,17 @@ const useFontFamilyFor = ({ italic, weight, }) => {
|
|
|
16
13
|
}
|
|
17
14
|
return fonts.sans.regular;
|
|
18
15
|
};
|
|
19
|
-
exports.useFontFamilyFor = useFontFamilyFor;
|
|
20
16
|
/**
|
|
21
17
|
* Use this function within Palette and other "atom" components like `Button`, `Pill`, etc.
|
|
22
18
|
* This function returns a `TextStyle` that has a `fontSize` and `lineHeight` of the same number.
|
|
23
19
|
* This is to make a `Text` behave correctly when it needs to be combined with others to make a UI component.
|
|
24
20
|
* Don't use this function when some actual text needs to be displayed. Only use it when text needs to be part of a UI component.
|
|
25
21
|
*/
|
|
26
|
-
const useTextStyleForPalette = (variant) => {
|
|
27
|
-
const { theme } =
|
|
22
|
+
export const useTextStyleForPalette = (variant) => {
|
|
23
|
+
const { theme } = useTheme();
|
|
28
24
|
const fontSizeAndLineHeight = theme.textTreatments[variant].fontSize;
|
|
29
25
|
return {
|
|
30
26
|
fontSize: fontSizeAndLineHeight,
|
|
31
27
|
lineHeight: fontSizeAndLineHeight,
|
|
32
28
|
};
|
|
33
29
|
};
|
|
34
|
-
exports.useTextStyleForPalette = useTextStyleForPalette;
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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("./helpers"), exports);
|
|
18
|
-
__exportStar(require("./Text"), exports);
|
|
19
|
-
__exportStar(require("./LinkText"), exports);
|
|
1
|
+
export * from "./helpers";
|
|
2
|
+
export * from "./Text";
|
|
3
|
+
export * from "./LinkText";
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.ToolTipContext = (0, react_1.createContext)({
|
|
13
|
-
dismissToolTip: () => lodash_1.noop,
|
|
14
|
-
setToolTip: () => lodash_1.noop,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { noop } from "lodash";
|
|
3
|
+
import { createContext, useContext, useRef, useState } from "react";
|
|
4
|
+
import { View } from "react-native";
|
|
5
|
+
import { ToolTipFlyout, ToolTipTextContainer } from "./ToolTipFlyout";
|
|
6
|
+
import { TriangleDown } from "../../svgs/TriangleDown";
|
|
7
|
+
import { useScreenDimensions } from "../../utils/hooks/useScreenDimensions";
|
|
8
|
+
import { useTheme } from "../../utils/hooks/useTheme";
|
|
9
|
+
export const ToolTipContext = createContext({
|
|
10
|
+
dismissToolTip: () => noop,
|
|
11
|
+
setToolTip: () => noop,
|
|
15
12
|
});
|
|
16
13
|
/**
|
|
17
14
|
* A ToolTip Component
|
|
@@ -33,16 +30,16 @@ exports.ToolTipContext = (0, react_1.createContext)({
|
|
|
33
30
|
* </ToolTip>
|
|
34
31
|
*
|
|
35
32
|
*/
|
|
36
|
-
const ToolTip = ({ children, enabled = true, flowDirection, initialToolTipText, maxWidth, onPress, position = "TOP", tapToDismiss = false, testID, xOffset = 0, yOffset = 5, }) => {
|
|
37
|
-
const { space } =
|
|
38
|
-
const mWidth =
|
|
33
|
+
export const ToolTip = ({ children, enabled = true, flowDirection, initialToolTipText, maxWidth, onPress, position = "TOP", tapToDismiss = false, testID, xOffset = 0, yOffset = 5, }) => {
|
|
34
|
+
const { space } = useTheme();
|
|
35
|
+
const mWidth = useScreenDimensions().width - space(2) * 2; // 40 accounting for padding 20 on each side of the screen
|
|
39
36
|
const MAX_TOOLTIP_WIDTH = maxWidth ?? mWidth;
|
|
40
|
-
const [toolTipText, setToolTip] =
|
|
41
|
-
const [childrenDimensions, setChildrenDimensions] =
|
|
42
|
-
const [singleTextDimension, setSingleTextDimension] =
|
|
37
|
+
const [toolTipText, setToolTip] = useState(initialToolTipText);
|
|
38
|
+
const [childrenDimensions, setChildrenDimensions] = useState({ height: 0, width: 0, x: 0 });
|
|
39
|
+
const [singleTextDimension, setSingleTextDimension] = useState({ height: 0, width: 0 });
|
|
43
40
|
const dismissToolTip = () => setToolTip(undefined);
|
|
44
|
-
const [pageX, setPageX] =
|
|
45
|
-
const childrenRef =
|
|
41
|
+
const [pageX, setPageX] = useState(0);
|
|
42
|
+
const childrenRef = useRef(null);
|
|
46
43
|
const totalTextWidth = singleTextDimension.width * (toolTipText?.length ?? 0);
|
|
47
44
|
const finalToolTipWidth = Math.min(totalTextWidth, MAX_TOOLTIP_WIDTH);
|
|
48
45
|
const numOfLines = getNumberOfLines(finalToolTipWidth, totalTextWidth);
|
|
@@ -54,18 +51,18 @@ const ToolTip = ({ children, enabled = true, flowDirection, initialToolTipText,
|
|
|
54
51
|
const nearLeftEdge = pageX < mWidth / 4 || flowDirection === "RIGHT";
|
|
55
52
|
const nearRightEdge = pageX > mWidth - mWidth / 4 || flowDirection === "LEFT";
|
|
56
53
|
const extraStyle = nearLeftEdge ? { left: 0 } : nearRightEdge ? { right: 0 } : undefined;
|
|
57
|
-
return ((
|
|
54
|
+
return (_jsxs(ToolTipContext.Provider, { value: {
|
|
58
55
|
dismissToolTip,
|
|
59
56
|
setToolTip,
|
|
60
|
-
}, children: [!!enabled && position === "TOP" && ((
|
|
57
|
+
}, children: [!!enabled && position === "TOP" && (_jsxs(_Fragment, { children: [_jsx(ToolTipFlyout, { containerStyle: {
|
|
61
58
|
bottom: childrenDimensions.height + yOffset,
|
|
62
59
|
left: xOffset,
|
|
63
60
|
...extraStyle,
|
|
64
|
-
}, tapToDismiss: tapToDismiss, height: finalToolTipHeight, width: finalToolTipWidth, onClose: dismissToolTip, onToolTipPress: onPress, position: position, testID: testID, text: toolTipText }), !!enabled && position === "TOP" && !!toolTipText && ((
|
|
61
|
+
}, tapToDismiss: tapToDismiss, height: finalToolTipHeight, width: finalToolTipWidth, onClose: dismissToolTip, onToolTipPress: onPress, position: position, testID: testID, text: toolTipText }), !!enabled && position === "TOP" && !!toolTipText && (_jsx(TriangleDown, { style: {
|
|
65
62
|
left: triangleXDisplacement + xOffset,
|
|
66
63
|
position: "absolute",
|
|
67
64
|
bottom: childrenDimensions.height + yOffset - 5, // where 5 is the triangle icon size
|
|
68
|
-
} }))] })), (
|
|
65
|
+
} }))] })), _jsx(View, { ref: childrenRef, onLayout: (event) => {
|
|
69
66
|
setChildrenDimensions({
|
|
70
67
|
height: event.nativeEvent.layout.height,
|
|
71
68
|
width: event.nativeEvent.layout.width,
|
|
@@ -74,30 +71,28 @@ const ToolTip = ({ children, enabled = true, flowDirection, initialToolTipText,
|
|
|
74
71
|
childrenRef.current?.measure((_fx, _fy, _width, _height, px, _py) => {
|
|
75
72
|
setPageX(px);
|
|
76
73
|
});
|
|
77
|
-
}, children: children }), !!enabled && position === "BOTTOM" && ((
|
|
74
|
+
}, children: children }), !!enabled && position === "BOTTOM" && (_jsxs(_Fragment, { children: [_jsx(ToolTipFlyout, { containerStyle: {
|
|
78
75
|
top: childrenDimensions.height + yOffset,
|
|
79
76
|
...extraStyle,
|
|
80
|
-
}, tapToDismiss: tapToDismiss, height: finalToolTipHeight, width: finalToolTipWidth, onClose: dismissToolTip, onToolTipPress: onPress, position: position, testID: testID, text: toolTipText }), !!enabled && position === "BOTTOM" && !!toolTipText && ((
|
|
77
|
+
}, tapToDismiss: tapToDismiss, height: finalToolTipHeight, width: finalToolTipWidth, onClose: dismissToolTip, onToolTipPress: onPress, position: position, testID: testID, text: toolTipText }), !!enabled && position === "BOTTOM" && !!toolTipText && (_jsx(TriangleDown, { style: {
|
|
81
78
|
transform: [{ rotate: "180deg" }],
|
|
82
79
|
left: triangleXDisplacement + xOffset,
|
|
83
80
|
position: "absolute",
|
|
84
81
|
top: childrenDimensions.height + yOffset - 5, // where 5 is the triangle icon size,
|
|
85
|
-
} }))] })), !!enabled && !!toolTipText && ((
|
|
82
|
+
} }))] })), !!enabled && !!toolTipText && (_jsx(View, { style: { position: "absolute", opacity: 0 }, onLayout: ({ nativeEvent }) => {
|
|
86
83
|
setSingleTextDimension({
|
|
87
84
|
height: nativeEvent.layout.height,
|
|
88
85
|
width: nativeEvent.layout.width,
|
|
89
86
|
});
|
|
90
|
-
}, children: (
|
|
87
|
+
}, children: _jsx(ToolTipTextContainer, { text: "x" }) }))] }));
|
|
91
88
|
};
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
const context = (0, react_1.useContext)(exports.ToolTipContext);
|
|
89
|
+
export const useToolTipContext = () => {
|
|
90
|
+
const context = useContext(ToolTipContext);
|
|
95
91
|
if (!context) {
|
|
96
92
|
throw new Error("Attempted to use useToolTipContext outside of ToolTip Provider. Please wrap your component with <ToolTip>");
|
|
97
93
|
}
|
|
98
94
|
return context;
|
|
99
95
|
};
|
|
100
|
-
exports.useToolTipContext = useToolTipContext;
|
|
101
96
|
/** Given a maximum width and a total width, how many of the maximum widths can we get from the total width?
|
|
102
97
|
* The answer gotten will let us know how many lines of text the tool tip text will need.
|
|
103
98
|
* Note: We add one for whatever spill over remains i.e text that does not fill an entire line.
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
(
|
|
10
|
-
.add("
|
|
11
|
-
|
|
12
|
-
.add("Change ToolTip", () => ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignSelf: "center", mt: "200px", children: (0, jsx_runtime_1.jsx)(ToolTip_1.ToolTip, { initialToolTipText: "I can be changed", position: "TOP", tapToDismiss: true, children: (0, jsx_runtime_1.jsx)(ToolTip_1.ToolTipContext.Consumer, { children: ({ setToolTip }) => {
|
|
13
|
-
return ((0, jsx_runtime_1.jsx)(Button_1.Button, { size: "small", onPress: () => setToolTip("I'm the new tooltip"), children: "Press To Change ToolTip" }));
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { storiesOf } from "@storybook/react-native";
|
|
3
|
+
import { ToolTip, ToolTipContext } from "./ToolTip";
|
|
4
|
+
import { Button } from "../Button";
|
|
5
|
+
import { Flex } from "../Flex";
|
|
6
|
+
import { Text } from "../Text";
|
|
7
|
+
storiesOf("ToolTip", module)
|
|
8
|
+
.add("Simple ToolTip", () => (_jsx(Flex, { alignSelf: "center", mt: "200px", alignItems: "center", flexWrap: "wrap", children: _jsx(ToolTip, { initialToolTipText: "Tap to dismiss me", position: "TOP", tapToDismiss: true, children: _jsx(Text, { weight: "medium", children: "I am a Text" }) }) })))
|
|
9
|
+
.add("Bottom ToolTip", () => (_jsx(Flex, { alignSelf: "center", mt: "200px", flexWrap: "wrap", children: _jsx(ToolTip, { initialToolTipText: "Bottom tooltip", position: "BOTTOM", tapToDismiss: true, children: _jsx(Text, { weight: "medium", children: "I am a Text" }) }) })))
|
|
10
|
+
.add("Change ToolTip", () => (_jsx(Flex, { alignSelf: "center", mt: "200px", children: _jsx(ToolTip, { initialToolTipText: "I can be changed", position: "TOP", tapToDismiss: true, children: _jsx(ToolTipContext.Consumer, { children: ({ setToolTip }) => {
|
|
11
|
+
return (_jsx(Button, { size: "small", onPress: () => setToolTip("I'm the new tooltip"), children: "Press To Change ToolTip" }));
|
|
14
12
|
} }) }) })));
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const renderWithWrappers_1 = require("../../utils/tests/renderWithWrappers");
|
|
7
|
-
const Text_1 = require("../Text");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ToolTip } from "./ToolTip";
|
|
3
|
+
import { ScreenDimensionsProvider } from "../../utils/hooks";
|
|
4
|
+
import { renderWithWrappers } from "../../utils/tests/renderWithWrappers";
|
|
5
|
+
import { Text } from "../Text";
|
|
8
6
|
describe("ToolTip", () => {
|
|
9
7
|
it("shows the flyout when enabled", () => {
|
|
10
|
-
const { queryByTestId } =
|
|
8
|
+
const { queryByTestId } = renderWithWrappers(_jsx(ScreenDimensionsProvider, { children: _jsx(ToolTip, { enabled: true, testID: "flyout", initialToolTipText: "Words", children: _jsx(Text, { children: "Text" }) }) }));
|
|
11
9
|
expect(queryByTestId("flyout")).not.toBeNull();
|
|
12
10
|
});
|
|
13
11
|
it("Does not show the flyout when disabled", () => {
|
|
14
|
-
const { queryByTestId } =
|
|
12
|
+
const { queryByTestId } = renderWithWrappers(_jsx(ScreenDimensionsProvider, { children: _jsx(ToolTip, { enabled: false, testID: "flyout", initialToolTipText: "Words", children: _jsx(Text, { children: "Text" }) }) }));
|
|
15
13
|
expect(queryByTestId("flyout")).toBeNull();
|
|
16
14
|
});
|
|
17
15
|
});
|
|
@@ -1,50 +1,24 @@
|
|
|
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.ToolTipTextContainer = exports.ToolTipFlyout = 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 useColor_1 = require("../../utils/hooks/useColor");
|
|
32
|
-
const Flex_1 = require("../Flex");
|
|
33
|
-
const Text_1 = require("../Text");
|
|
34
|
-
const ToolTipFlyout = ({ containerStyle, tapToDismiss, height, width, onClose, onToolTipPress, testID, text, }) => {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { TouchableWithoutFeedback } from "react-native";
|
|
4
|
+
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
5
|
+
import { useColor } from "../../utils/hooks/useColor";
|
|
6
|
+
import { Flex } from "../Flex";
|
|
7
|
+
import { Text } from "../Text";
|
|
8
|
+
export const ToolTipFlyout = ({ containerStyle, tapToDismiss, height, width, onClose, onToolTipPress, testID, text, }) => {
|
|
35
9
|
const initialBoxDimensions = { height: 0, width: 0 };
|
|
36
|
-
const boxDimensions =
|
|
37
|
-
const animationStyle =
|
|
10
|
+
const boxDimensions = useSharedValue(initialBoxDimensions);
|
|
11
|
+
const animationStyle = useAnimatedStyle(() => {
|
|
38
12
|
return {
|
|
39
|
-
height:
|
|
13
|
+
height: withTiming(boxDimensions.value.height, {
|
|
40
14
|
duration: 500,
|
|
41
15
|
}),
|
|
42
|
-
width:
|
|
16
|
+
width: withTiming(boxDimensions.value.width, {
|
|
43
17
|
duration: 500,
|
|
44
18
|
}),
|
|
45
19
|
};
|
|
46
20
|
});
|
|
47
|
-
|
|
21
|
+
useEffect(() => {
|
|
48
22
|
if (text) {
|
|
49
23
|
boxDimensions.value = {
|
|
50
24
|
height,
|
|
@@ -56,7 +30,7 @@ const ToolTipFlyout = ({ containerStyle, tapToDismiss, height, width, onClose, o
|
|
|
56
30
|
}
|
|
57
31
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
32
|
}, [text, height, width]);
|
|
59
|
-
const color =
|
|
33
|
+
const color = useColor();
|
|
60
34
|
const handleClose = () => {
|
|
61
35
|
onClose();
|
|
62
36
|
};
|
|
@@ -66,7 +40,7 @@ const ToolTipFlyout = ({ containerStyle, tapToDismiss, height, width, onClose, o
|
|
|
66
40
|
handleClose();
|
|
67
41
|
}
|
|
68
42
|
};
|
|
69
|
-
return ((
|
|
43
|
+
return (_jsx(TouchableWithoutFeedback, { onPress: onPress, testID: testID, children: _jsx(Animated.View, { style: [
|
|
70
44
|
{
|
|
71
45
|
backgroundColor: color("black100"),
|
|
72
46
|
position: "absolute",
|
|
@@ -75,14 +49,12 @@ const ToolTipFlyout = ({ containerStyle, tapToDismiss, height, width, onClose, o
|
|
|
75
49
|
},
|
|
76
50
|
containerStyle,
|
|
77
51
|
animationStyle,
|
|
78
|
-
], children: (
|
|
52
|
+
], children: _jsx(Flex, { justifyContent: "center", alignItems: "center", bg: "black100", children: _jsx(ToolTipTextContainer, { text: text }) }) }) }));
|
|
79
53
|
};
|
|
80
|
-
exports.ToolTipFlyout = ToolTipFlyout;
|
|
81
54
|
/** Please be careful with applying any styling here. This forms the basis with which we measure
|
|
82
55
|
* in advance by how large we can inflate a tooltip.
|
|
83
56
|
*/
|
|
84
|
-
const ToolTipTextContainer = ({ text }) => {
|
|
85
|
-
const color =
|
|
86
|
-
return ((
|
|
57
|
+
export const ToolTipTextContainer = ({ text }) => {
|
|
58
|
+
const color = useColor();
|
|
59
|
+
return (_jsx(Text, { variant: "xs", color: color("white100"), pb: 0.5, children: text }));
|
|
87
60
|
};
|
|
88
|
-
exports.ToolTipTextContainer = ToolTipTextContainer;
|
|
@@ -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("./ToolTip"), exports);
|
|
1
|
+
export * from "./ToolTip";
|
|
@@ -1,34 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const react_native_1 = require("react-native");
|
|
10
|
-
const react_native_haptic_feedback_1 = __importDefault(require("react-native-haptic-feedback"));
|
|
11
|
-
const constants_1 = require("../../constants");
|
|
12
|
-
const useColor_1 = require("../../utils/hooks/useColor");
|
|
13
|
-
const Flex_1 = require("../Flex");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { TouchableHighlight, TouchableWithoutFeedback, } from "react-native";
|
|
4
|
+
import Haptic from "react-native-haptic-feedback";
|
|
5
|
+
import { DEFAULT_ACTIVE_OPACITY } from "../../constants";
|
|
6
|
+
import { useColor } from "../../utils/hooks/useColor";
|
|
7
|
+
import { Flex } from "../Flex";
|
|
14
8
|
/**
|
|
15
9
|
* `haptic` can be used like:
|
|
16
10
|
* <Touchable haptic />
|
|
17
11
|
* or
|
|
18
12
|
* <Touchable haptic="impactHeavy" />
|
|
19
13
|
*/
|
|
20
|
-
const Touchable = ({ children, flex, haptic, noFeedback, onPress, underlayColor, ...props }) => {
|
|
21
|
-
const color =
|
|
22
|
-
const inner =
|
|
14
|
+
export const Touchable = ({ children, flex, haptic, noFeedback, onPress, underlayColor, ...props }) => {
|
|
15
|
+
const color = useColor();
|
|
16
|
+
const inner = React.Children.count(children) === 1 ? children : _jsx(Flex, { flex: flex, children: children });
|
|
23
17
|
const onPressWrapped = (evt) => {
|
|
24
18
|
if (onPress === undefined) {
|
|
25
19
|
return;
|
|
26
20
|
}
|
|
27
21
|
if (haptic !== undefined) {
|
|
28
|
-
|
|
22
|
+
Haptic.trigger(haptic === true ? "impactLight" : haptic);
|
|
29
23
|
}
|
|
30
24
|
onPress(evt);
|
|
31
25
|
};
|
|
32
|
-
return noFeedback ? ((
|
|
26
|
+
return noFeedback ? (_jsx(TouchableWithoutFeedback, { ...props, onPress: onPressWrapped, children: inner })) : (_jsx(TouchableHighlight, { underlayColor: underlayColor ?? "transparent", activeOpacity: DEFAULT_ACTIVE_OPACITY, ...props, onPress: onPressWrapped, children: inner }));
|
|
33
27
|
};
|
|
34
|
-
exports.Touchable = Touchable;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const Flex_1 = require("../Flex");
|
|
9
|
-
const Text_1 = require("../Text");
|
|
10
|
-
exports.default = {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Touchable } from "./Touchable";
|
|
3
|
+
import { List } from "../../storybook/helpers";
|
|
4
|
+
import { TrashIcon } from "../../svgs";
|
|
5
|
+
import { Flex } from "../Flex";
|
|
6
|
+
import { Text } from "../Text";
|
|
7
|
+
export default {
|
|
11
8
|
title: "Touchable",
|
|
12
|
-
component:
|
|
9
|
+
component: Touchable,
|
|
13
10
|
};
|
|
14
|
-
const Examples = () => ((
|
|
15
|
-
exports.Examples = Examples;
|
|
11
|
+
export const Examples = () => (_jsxs(List, { children: [_jsx(Touchable, { children: _jsx(Text, { children: "This is a text wrapped in a `Touchable`." }) }), _jsx(Touchable, { children: _jsxs(Flex, { width: 200, alignItems: "center", borderColor: "red", borderWidth: 1, children: [_jsx(TrashIcon, {}), _jsx(Text, { children: "This is a cell with an icon and a text, wrapped in a `Touchable`." })] }) })] }));
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const Touchable_1 = require("./Touchable");
|
|
7
|
-
const TouchableHighlightColor = (props) => {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Touchable } from "./Touchable";
|
|
4
|
+
export const TouchableHighlightColor = (props) => {
|
|
8
5
|
const { activeOpacity = 1, activeColor = "blue100", normalColor = "black100", onPressIn, onPressOut, render, ...restProps } = props;
|
|
9
|
-
const [highlighted, setHighlighted] =
|
|
6
|
+
const [highlighted, setHighlighted] = useState(false);
|
|
10
7
|
const color = highlighted ? activeColor : normalColor;
|
|
11
|
-
return ((
|
|
8
|
+
return (_jsx(Touchable, { noFeedback: true, activeOpacity: activeOpacity, onPressIn: (event) => {
|
|
12
9
|
setHighlighted(true);
|
|
13
10
|
onPressIn?.(event);
|
|
14
11
|
}, onPressOut: (event) => {
|
|
@@ -16,4 +13,3 @@ const TouchableHighlightColor = (props) => {
|
|
|
16
13
|
onPressOut?.(event);
|
|
17
14
|
}, ...restProps, children: render({ color, highlighted }) }));
|
|
18
15
|
};
|
|
19
|
-
exports.TouchableHighlightColor = TouchableHighlightColor;
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.TouchableWithScale = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_native_1 = require("react-native");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Animated, TouchableWithoutFeedback, } from "react-native";
|
|
6
3
|
const ANIMATION_DEFAULTS = {
|
|
7
4
|
stiffness: 600,
|
|
8
5
|
damping: 120,
|
|
9
6
|
useNativeDriver: true,
|
|
10
7
|
};
|
|
11
8
|
const NOOP = () => { };
|
|
12
|
-
const TouchableWithScale = ({ defaultScale = 1, activeScale = 0.95, onPressIn = NOOP, onPressOut = NOOP, style, children, ...restProps }) => {
|
|
13
|
-
const scaleAnimation = new
|
|
9
|
+
export const TouchableWithScale = ({ defaultScale = 1, activeScale = 0.95, onPressIn = NOOP, onPressOut = NOOP, style, children, ...restProps }) => {
|
|
10
|
+
const scaleAnimation = new Animated.Value(defaultScale);
|
|
14
11
|
const handlePressIn = (event) => {
|
|
15
|
-
|
|
12
|
+
Animated.spring(scaleAnimation, { ...ANIMATION_DEFAULTS, toValue: activeScale }).start();
|
|
16
13
|
onPressIn(event);
|
|
17
14
|
};
|
|
18
15
|
const handlePressOut = (event) => {
|
|
19
|
-
|
|
16
|
+
Animated.spring(scaleAnimation, { ...ANIMATION_DEFAULTS, toValue: defaultScale }).start();
|
|
20
17
|
onPressOut(event);
|
|
21
18
|
};
|
|
22
|
-
return ((
|
|
19
|
+
return (_jsx(TouchableWithoutFeedback, { onPressIn: handlePressIn, onPressOut: handlePressOut, ...restProps, children: _jsx(Animated.View, { style: [style, { transform: [{ scale: scaleAnimation }] }], children: children }) }));
|
|
23
20
|
};
|
|
24
|
-
exports.TouchableWithScale = TouchableWithScale;
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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("./Touchable"), exports);
|
|
18
|
-
__exportStar(require("./TouchableWithScale"), exports);
|
|
19
|
-
__exportStar(require("./TouchableHighlightColor"), exports);
|
|
1
|
+
export * from "./Touchable";
|
|
2
|
+
export * from "./TouchableWithScale";
|
|
3
|
+
export * from "./TouchableHighlightColor";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const Text_1 = require("../Text");
|
|
8
|
-
(0, react_native_1.storiesOf)("Theme/Text", module).add("Visual Clue", () => ((0, jsx_runtime_1.jsxs)(helpers_1.List, { children: [(0, jsx_runtime_1.jsx)(_1.VisualClueDot, {}), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { children: "A Feature" }), (0, jsx_runtime_1.jsx)(_1.VisualClueText, { style: { top: 14, right: -24 } })] })] })));
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { storiesOf } from "@storybook/react-native";
|
|
3
|
+
import { VisualClueDot, VisualClueText } from "./";
|
|
4
|
+
import { List } from "../../storybook/helpers";
|
|
5
|
+
import { Text } from "../Text";
|
|
6
|
+
storiesOf("Theme/Text", module).add("Visual Clue", () => (_jsxs(List, { children: [_jsx(VisualClueDot, {}), _jsxs(_Fragment, { children: [_jsx(Text, { children: "A Feature" }), _jsx(VisualClueText, { style: { top: 14, right: -24 } })] })] })));
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const useColor_1 = require("../../utils/hooks/useColor");
|
|
6
|
-
const Flex_1 = require("../Flex");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useColor } from "../../utils/hooks/useColor";
|
|
3
|
+
import { Flex } from "../Flex";
|
|
7
4
|
const DOT_DIAMETER = 6;
|
|
8
|
-
const VisualClueDot = ({ diameter = DOT_DIAMETER, style }) => {
|
|
9
|
-
const color =
|
|
10
|
-
return ((
|
|
5
|
+
export const VisualClueDot = ({ diameter = DOT_DIAMETER, style }) => {
|
|
6
|
+
const color = useColor();
|
|
7
|
+
return (_jsx(Flex, { style: {
|
|
11
8
|
height: diameter,
|
|
12
9
|
minWidth: diameter,
|
|
13
10
|
borderRadius: diameter / 2,
|
|
@@ -15,4 +12,3 @@ const VisualClueDot = ({ diameter = DOT_DIAMETER, style }) => {
|
|
|
15
12
|
...style,
|
|
16
13
|
} }));
|
|
17
14
|
};
|
|
18
|
-
exports.VisualClueDot = VisualClueDot;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const Flex_1 = require("../Flex");
|
|
7
|
-
const PopIn_1 = require("../PopIn");
|
|
8
|
-
const Text_1 = require("../Text");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useColor } from "../../utils/hooks/useColor";
|
|
3
|
+
import { Flex } from "../Flex";
|
|
4
|
+
import { PopIn } from "../PopIn";
|
|
5
|
+
import { Text } from "../Text";
|
|
9
6
|
const WRAPPER_WIDTH = 56;
|
|
10
7
|
const WRAPPER_HEIGHT = 46;
|
|
11
|
-
const VisualClueText = ({ style = {} }) => {
|
|
12
|
-
const colors =
|
|
13
|
-
return ((
|
|
8
|
+
export const VisualClueText = ({ style = {} }) => {
|
|
9
|
+
const colors = useColor();
|
|
10
|
+
return (_jsx(Flex, { width: 0, overflow: "visible", children: _jsx(Flex, { width: 55, justifyContent: "center", children: _jsx(Flex, { style: {
|
|
14
11
|
width: WRAPPER_WIDTH,
|
|
15
12
|
height: WRAPPER_HEIGHT,
|
|
16
13
|
...style,
|
|
17
14
|
position: "absolute",
|
|
18
|
-
}, children: (
|
|
15
|
+
}, children: _jsx(PopIn, { children: _jsx(Text, { style: { fontSize: 12, color: colors("blue100") }, children: "New" }) }) }) }) }));
|
|
19
16
|
};
|
|
20
|
-
exports.VisualClueText = VisualClueText;
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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("./VisualClueText"), exports);
|
|
18
|
-
__exportStar(require("./VisualClueDot"), exports);
|
|
1
|
+
export * from "./VisualClueText";
|
|
2
|
+
export * from "./VisualClueDot";
|