@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.
Files changed (327) hide show
  1. package/dist/Theme.js +9 -13
  2. package/dist/animation/CssTransition.js +8 -12
  3. package/dist/animation/index.js +1 -17
  4. package/dist/constants.js +4 -8
  5. package/dist/elements/ArtsyKeyboardAvoidingView/ArtsyKeyboardAvoidingView.js +19 -23
  6. package/dist/elements/ArtsyKeyboardAvoidingView/index.js +1 -17
  7. package/dist/elements/Autocomplete/Autocomplete.js +4 -8
  8. package/dist/elements/Autocomplete/Autocomplete.tests.js +9 -11
  9. package/dist/elements/Autocomplete/index.js +1 -17
  10. package/dist/elements/Avatar/Avatar.js +17 -44
  11. package/dist/elements/Avatar/Avatar.stories.js +7 -11
  12. package/dist/elements/Avatar/Avatar.tests.js +8 -10
  13. package/dist/elements/Avatar/index.js +1 -17
  14. package/dist/elements/BackButton/BackButton.js +9 -14
  15. package/dist/elements/BackButton/BackButton.stories.js +8 -12
  16. package/dist/elements/BackButton/index.js +1 -17
  17. package/dist/elements/Banner/Banner.js +14 -18
  18. package/dist/elements/Banner/Banner.stories.js +7 -11
  19. package/dist/elements/Banner/index.js +1 -17
  20. package/dist/elements/BorderBox/BorderBox.js +9 -15
  21. package/dist/elements/BorderBox/index.js +1 -17
  22. package/dist/elements/Box/Box.js +11 -17
  23. package/dist/elements/Box/Box.stories.js +14 -20
  24. package/dist/elements/Box/index.js +1 -17
  25. package/dist/elements/Button/Button.js +30 -37
  26. package/dist/elements/Button/Button.stories.js +18 -25
  27. package/dist/elements/Button/CTAButton.js +3 -7
  28. package/dist/elements/Button/FollowButton.js +7 -11
  29. package/dist/elements/Button/LinkButton.js +4 -8
  30. package/dist/elements/Button/colors.js +3 -7
  31. package/dist/elements/Button/index.js +4 -20
  32. package/dist/elements/ButtonNew/Button.js +32 -62
  33. package/dist/elements/ButtonNew/Button.stories.js +36 -50
  34. package/dist/elements/ButtonNew/Button.tests.js +13 -15
  35. package/dist/elements/ButtonNew/CTAButton.js +3 -7
  36. package/dist/elements/ButtonNew/FollowButton.js +7 -11
  37. package/dist/elements/ButtonNew/LinkButton.js +4 -8
  38. package/dist/elements/ButtonNew/colors.js +3 -7
  39. package/dist/elements/ButtonNew/index.js +4 -20
  40. package/dist/elements/Checkbox/Check.js +29 -56
  41. package/dist/elements/Checkbox/Checkbox.js +22 -30
  42. package/dist/elements/Checkbox/Checkbox.stories.js +8 -12
  43. package/dist/elements/Checkbox/index.js +2 -18
  44. package/dist/elements/ClassTheme/ClassTheme.js +5 -9
  45. package/dist/elements/ClassTheme/index.js +1 -17
  46. package/dist/elements/Collapse/Collapse.js +4 -8
  47. package/dist/elements/Collapse/Collapse.stories.js +9 -13
  48. package/dist/elements/Collapse/index.js +1 -17
  49. package/dist/elements/CollapsibleMenuItem/CollapsibleMenuItem.js +18 -21
  50. package/dist/elements/CollapsibleMenuItem/CollapsibleMenuItem.stories.js +30 -38
  51. package/dist/elements/CollapsibleMenuItem/index.js +1 -17
  52. package/dist/elements/Dialog/Dialog.js +20 -24
  53. package/dist/elements/Dialog/Dialog.stories.js +14 -16
  54. package/dist/elements/Dialog/Dialog.tests.js +12 -14
  55. package/dist/elements/Dialog/index.js +1 -17
  56. package/dist/elements/EntityHeader/EntityHeader.js +14 -18
  57. package/dist/elements/EntityHeader/EntityHeader.stories.js +17 -25
  58. package/dist/elements/EntityHeader/index.js +1 -17
  59. package/dist/elements/Flex/Flex.js +4 -7
  60. package/dist/elements/Flex/index.js +1 -17
  61. package/dist/elements/Header/ArtsyLogoHeader.js +8 -12
  62. package/dist/elements/Header/index.js +1 -17
  63. package/dist/elements/Histogram/Histogram.js +6 -10
  64. package/dist/elements/Histogram/index.js +1 -17
  65. package/dist/elements/Image/Image.js +26 -55
  66. package/dist/elements/Image/Image.stories.js +14 -16
  67. package/dist/elements/Image/index.js +1 -17
  68. package/dist/elements/Input/Input.js +127 -157
  69. package/dist/elements/Input/Input.stories.js +9 -11
  70. package/dist/elements/Input/Input.tests.js +17 -19
  71. package/dist/elements/Input/InputTitle.js +4 -8
  72. package/dist/elements/Input/helpers.d.ts +1 -1
  73. package/dist/elements/Input/helpers.js +51 -56
  74. package/dist/elements/Input/index.js +3 -19
  75. package/dist/elements/Input/maskValue.js +5 -10
  76. package/dist/elements/Input/maskValue.tests.js +11 -13
  77. package/dist/elements/Join/Join.js +6 -10
  78. package/dist/elements/Join/index.js +1 -17
  79. package/dist/elements/LazyFlatlist/LazyFlatlist.js +3 -7
  80. package/dist/elements/LazyFlatlist/index.js +2 -18
  81. package/dist/elements/LazyFlatlist/useHasSeenItem.js +6 -10
  82. package/dist/elements/LegacyScreen/LegacyScreen.js +51 -59
  83. package/dist/elements/LegacyScreen/index.js +1 -17
  84. package/dist/elements/LegacyTabs/ContentTabs.js +8 -12
  85. package/dist/elements/LegacyTabs/NavigationalTabs.js +11 -15
  86. package/dist/elements/LegacyTabs/StepTabs.js +15 -19
  87. package/dist/elements/LegacyTabs/Tab.js +9 -13
  88. package/dist/elements/LegacyTabs/TabBarContainer.js +28 -34
  89. package/dist/elements/LegacyTabs/index.js +9 -15
  90. package/dist/elements/List/BulletedItem.js +7 -11
  91. package/dist/elements/List/List.stories.js +8 -10
  92. package/dist/elements/List/index.js +1 -17
  93. package/dist/elements/MeasuredView/MeasuredView.js +10 -15
  94. package/dist/elements/MeasuredView/index.js +1 -17
  95. package/dist/elements/MenuItem/MenuItem.js +9 -13
  96. package/dist/elements/MenuItem/MenuItem.stories.js +5 -9
  97. package/dist/elements/MenuItem/index.js +1 -17
  98. package/dist/elements/Message/Message.js +15 -19
  99. package/dist/elements/Message/Message.stories.js +10 -12
  100. package/dist/elements/Message/Message.tests.js +9 -11
  101. package/dist/elements/Message/index.js +1 -17
  102. package/dist/elements/Pill/Pill.js +53 -83
  103. package/dist/elements/Pill/Pill.stories.js +16 -18
  104. package/dist/elements/Pill/Pill.tests.js +8 -10
  105. package/dist/elements/Pill/index.js +1 -17
  106. package/dist/elements/PopIn/PopIn.js +8 -12
  107. package/dist/elements/PopIn/index.js +1 -17
  108. package/dist/elements/Popover/Popover.js +21 -28
  109. package/dist/elements/Popover/Popover.stories.js +15 -17
  110. package/dist/elements/Popover/index.js +1 -17
  111. package/dist/elements/ProgressBar/ProgressBar.js +16 -43
  112. package/dist/elements/ProgressBar/ProgressBar.stories.js +6 -8
  113. package/dist/elements/ProgressBar/ProgressBar.tests.js +7 -9
  114. package/dist/elements/ProgressBar/index.js +1 -17
  115. package/dist/elements/Radio/RadioButton.js +20 -28
  116. package/dist/elements/Radio/RadioButton.stories.js +13 -15
  117. package/dist/elements/Radio/RadioDot.js +10 -14
  118. package/dist/elements/Radio/index.js +2 -7
  119. package/dist/elements/Screen/Background.js +3 -7
  120. package/dist/elements/Screen/Body.js +9 -13
  121. package/dist/elements/Screen/BottomView.js +9 -16
  122. package/dist/elements/Screen/FloatingHeader.js +9 -13
  123. package/dist/elements/Screen/FullWidthDivider.js +5 -9
  124. package/dist/elements/Screen/FullWidthItem.js +5 -9
  125. package/dist/elements/Screen/Header.js +21 -49
  126. package/dist/elements/Screen/Screen.stories.js +18 -20
  127. package/dist/elements/Screen/ScreenBase.js +9 -13
  128. package/dist/elements/Screen/ScreenFlatList.js +8 -15
  129. package/dist/elements/Screen/ScreenScrollContext.js +9 -14
  130. package/dist/elements/Screen/ScreenScrollView.js +8 -15
  131. package/dist/elements/Screen/StickySubHeader.js +20 -47
  132. package/dist/elements/Screen/constants.js +5 -8
  133. package/dist/elements/Screen/hooks/useAnimatedHeaderScrolling.js +10 -14
  134. package/dist/elements/Screen/hooks/useListenForScreenScroll.js +10 -14
  135. package/dist/elements/Screen/index.js +29 -46
  136. package/dist/elements/SearchInput/SearchInput.js +6 -10
  137. package/dist/elements/SearchInput/index.js +1 -17
  138. package/dist/elements/Separator/Separator.js +9 -15
  139. package/dist/elements/Separator/Separator.stories.js +6 -10
  140. package/dist/elements/Separator/ShadowSeparator.js +3 -9
  141. package/dist/elements/Separator/index.js +2 -18
  142. package/dist/elements/SimpleMessage/SimpleMessage.js +9 -16
  143. package/dist/elements/SimpleMessage/index.js +1 -17
  144. package/dist/elements/Skeleton/Skeleton.js +16 -45
  145. package/dist/elements/Skeleton/Skeleton.stories.js +10 -14
  146. package/dist/elements/Skeleton/index.js +1 -17
  147. package/dist/elements/Spacer/Spacer.js +3 -7
  148. package/dist/elements/Spacer/Spacer.stories.js +15 -20
  149. package/dist/elements/Spacer/index.js +1 -17
  150. package/dist/elements/Spinner/Spinner.js +15 -23
  151. package/dist/elements/Spinner/index.js +1 -17
  152. package/dist/elements/Switch/Switch.js +8 -12
  153. package/dist/elements/Switch/Switch.stories.js +11 -15
  154. package/dist/elements/Switch/index.js +1 -17
  155. package/dist/elements/Tabs/SubTabBar.js +11 -15
  156. package/dist/elements/Tabs/TabFlashList.js +8 -12
  157. package/dist/elements/Tabs/TabFlatList.js +8 -12
  158. package/dist/elements/Tabs/TabMasonry.js +8 -12
  159. package/dist/elements/Tabs/TabScrollView.js +8 -12
  160. package/dist/elements/Tabs/Tabs.js +24 -27
  161. package/dist/elements/Tabs/Tabs.stories.js +11 -13
  162. package/dist/elements/Tabs/TabsContainer.js +15 -19
  163. package/dist/elements/Tabs/TabsWithHeader.js +8 -12
  164. package/dist/elements/Tabs/hooks/useListenForTabContentScroll.js +8 -12
  165. package/dist/elements/Tabs/index.js +1 -17
  166. package/dist/elements/Text/LinkText.js +3 -7
  167. package/dist/elements/Text/Text.js +15 -21
  168. package/dist/elements/Text/Text.stories.js +18 -27
  169. package/dist/elements/Text/Text.tests.js +3 -5
  170. package/dist/elements/Text/helpers.js +5 -10
  171. package/dist/elements/Text/index.js +3 -19
  172. package/dist/elements/ToolTip/ToolTip.js +29 -34
  173. package/dist/elements/ToolTip/ToolTip.stories.js +11 -13
  174. package/dist/elements/ToolTip/ToolTip.tests.js +7 -9
  175. package/dist/elements/ToolTip/ToolTipFlyout.js +19 -47
  176. package/dist/elements/ToolTip/index.js +1 -17
  177. package/dist/elements/Touchable/Touchable.js +12 -19
  178. package/dist/elements/Touchable/Touchable.stories.js +9 -13
  179. package/dist/elements/Touchable/TouchableHighlightColor.js +6 -10
  180. package/dist/elements/Touchable/TouchableWithScale.js +7 -11
  181. package/dist/elements/Touchable/index.js +3 -19
  182. package/dist/elements/VisualClue/VisualClue.stories.js +6 -8
  183. package/dist/elements/VisualClue/VisualClueDot.js +6 -10
  184. package/dist/elements/VisualClue/VisualClueText.js +9 -13
  185. package/dist/elements/VisualClue/index.js +2 -18
  186. package/dist/elements/index.js +45 -61
  187. package/dist/index.js +10 -26
  188. package/dist/setupJest.js +2 -7
  189. package/dist/storybook/decorators.js +20 -28
  190. package/dist/storybook/helpers.js +6 -12
  191. package/dist/svgs/AddCircleFillIcon.js +6 -10
  192. package/dist/svgs/AddCircleIcon.js +6 -10
  193. package/dist/svgs/AddIcon.js +6 -10
  194. package/dist/svgs/AlertCircleFillIcon.js +6 -10
  195. package/dist/svgs/AlertIcon.js +6 -10
  196. package/dist/svgs/ArrowCircleFillIcons.js +7 -12
  197. package/dist/svgs/ArrowDownCircleIcon.js +6 -10
  198. package/dist/svgs/ArrowDownIcon.js +6 -10
  199. package/dist/svgs/ArrowLeftCircleIcon.js +6 -10
  200. package/dist/svgs/ArrowLeftIcon.js +6 -10
  201. package/dist/svgs/ArrowRightCircleIcon.js +6 -10
  202. package/dist/svgs/ArrowRightIcon.js +6 -10
  203. package/dist/svgs/ArrowUpCircleIcon.js +6 -10
  204. package/dist/svgs/ArrowUpIcon.js +6 -10
  205. package/dist/svgs/ArtsyLogoBlackIcon.js +6 -10
  206. package/dist/svgs/ArtsyLogoWhiteIcon.js +4 -8
  207. package/dist/svgs/ArtsyMarkBlackIcon.js +6 -10
  208. package/dist/svgs/ArtsyMarkWhiteIcon.js +4 -8
  209. package/dist/svgs/ArtworkIcon.js +6 -10
  210. package/dist/svgs/AuctionIcon.js +6 -10
  211. package/dist/svgs/BellFillIcon.js +6 -10
  212. package/dist/svgs/BellIcon.js +6 -10
  213. package/dist/svgs/BlueChipIcon.js +6 -10
  214. package/dist/svgs/BoltCircleFill.js +6 -10
  215. package/dist/svgs/BoltFill.js +6 -10
  216. package/dist/svgs/BookmarkFill.js +6 -10
  217. package/dist/svgs/BriefcaseIcon.js +6 -10
  218. package/dist/svgs/CertificateIcon.js +6 -10
  219. package/dist/svgs/CheckCircleFillIcon.js +6 -10
  220. package/dist/svgs/CheckCircleIcon.js +6 -10
  221. package/dist/svgs/CheckIcon.js +6 -10
  222. package/dist/svgs/ChevronIcon.js +11 -15
  223. package/dist/svgs/ClockFill.js +6 -10
  224. package/dist/svgs/CloseCircleFillIcon.js +6 -10
  225. package/dist/svgs/CloseCircleIcon.js +6 -10
  226. package/dist/svgs/CloseIcon.js +6 -10
  227. package/dist/svgs/CollapseIcon.js +6 -10
  228. package/dist/svgs/CreditCardIcon.js +14 -18
  229. package/dist/svgs/DecreaseIcon.js +6 -10
  230. package/dist/svgs/DocumentIcon.js +6 -10
  231. package/dist/svgs/DownloadIcon.js +6 -10
  232. package/dist/svgs/EditIcon.js +6 -10
  233. package/dist/svgs/EmptyCheckCircleIcon.js +6 -10
  234. package/dist/svgs/EnterIcon.js +6 -10
  235. package/dist/svgs/EnvelopeIcon.js +6 -10
  236. package/dist/svgs/EstablishedIcon.js +6 -10
  237. package/dist/svgs/ExclamationMarkCircleFill.js +6 -10
  238. package/dist/svgs/ExpandIcon.js +6 -10
  239. package/dist/svgs/EyeClosedIcon.js +6 -10
  240. package/dist/svgs/EyeOpenedIcon.js +6 -10
  241. package/dist/svgs/FacebookIcon.js +6 -10
  242. package/dist/svgs/FairIcon.js +6 -10
  243. package/dist/svgs/FilterIcon.js +6 -10
  244. package/dist/svgs/FullWidthIcon.js +6 -10
  245. package/dist/svgs/GenomeIcon.js +6 -10
  246. package/dist/svgs/GraphIcon.js +6 -10
  247. package/dist/svgs/GridIcon.js +6 -10
  248. package/dist/svgs/GuaranteeIcon.js +7 -11
  249. package/dist/svgs/HeartFillIcon.js +6 -10
  250. package/dist/svgs/HeartIcon.js +6 -10
  251. package/dist/svgs/HideIcon.js +6 -10
  252. package/dist/svgs/HomeIcon.js +6 -10
  253. package/dist/svgs/Icon.js +15 -30
  254. package/dist/svgs/ImageIcon.js +6 -10
  255. package/dist/svgs/ImageSetIcon.js +6 -10
  256. package/dist/svgs/IncreaseIcon.js +6 -10
  257. package/dist/svgs/InfoCircleIcon.js +6 -10
  258. package/dist/svgs/InstagramAppIcon.js +3 -7
  259. package/dist/svgs/InstitutionIcon.js +6 -10
  260. package/dist/svgs/LinkIcon.js +6 -10
  261. package/dist/svgs/LoaderIcon.js +6 -10
  262. package/dist/svgs/LockIcon.js +6 -10
  263. package/dist/svgs/LogoutIcon.js +6 -10
  264. package/dist/svgs/MagnifyingGlassIcon.js +6 -10
  265. package/dist/svgs/MapPinIcon.js +6 -10
  266. package/dist/svgs/MenuIcon.js +6 -10
  267. package/dist/svgs/MessageIcon.js +7 -11
  268. package/dist/svgs/MessagesAppIcon.js +4 -8
  269. package/dist/svgs/MoneyCircleIcon.js +6 -10
  270. package/dist/svgs/MoneyFillIcon.js +6 -10
  271. package/dist/svgs/MoreIcon.js +6 -10
  272. package/dist/svgs/MultiplePersonsIcon.js +6 -10
  273. package/dist/svgs/NoArtworkIcon.js +6 -10
  274. package/dist/svgs/NoImageIcon.js +6 -10
  275. package/dist/svgs/PageIcon.js +6 -10
  276. package/dist/svgs/Payment2Icon.js +6 -10
  277. package/dist/svgs/PaymentIcon.js +6 -10
  278. package/dist/svgs/PersonIcon.js +6 -10
  279. package/dist/svgs/PublicationIcon.js +6 -10
  280. package/dist/svgs/QuestionCircleIcon.js +6 -10
  281. package/dist/svgs/ReloadIcon.js +6 -10
  282. package/dist/svgs/SecureLockIcon.js +6 -10
  283. package/dist/svgs/SettingsIcon.js +6 -10
  284. package/dist/svgs/ShareIcon.js +6 -10
  285. package/dist/svgs/ShieldFilledIcon.js +6 -10
  286. package/dist/svgs/ShieldIcon.js +6 -10
  287. package/dist/svgs/StarCircleFill.js +6 -10
  288. package/dist/svgs/StarCircleIcon.js +6 -10
  289. package/dist/svgs/Stopwatch.js +6 -10
  290. package/dist/svgs/Tag2Icon.js +7 -11
  291. package/dist/svgs/TagIcon.js +6 -10
  292. package/dist/svgs/TimerIcon.js +6 -10
  293. package/dist/svgs/TopEmergingIcon.js +6 -10
  294. package/dist/svgs/TrashIcon.js +6 -10
  295. package/dist/svgs/TrendingIcon.js +6 -10
  296. package/dist/svgs/TriangleDown.js +6 -10
  297. package/dist/svgs/TwitterIcon.js +6 -10
  298. package/dist/svgs/UserMultiIcon.js +6 -10
  299. package/dist/svgs/UserSingleIcon.js +6 -10
  300. package/dist/svgs/VerifiedIcon.js +6 -10
  301. package/dist/svgs/VerifiedPersonIcon.js +6 -10
  302. package/dist/svgs/WhatsAppAppIcon.js +4 -8
  303. package/dist/svgs/WorldGlobeCircleIcon.js +6 -10
  304. package/dist/svgs/XCircleIcon.js +6 -10
  305. package/dist/svgs/icons.stories.js +11 -38
  306. package/dist/svgs/index.js +113 -129
  307. package/dist/tokens.js +9 -12
  308. package/dist/types.js +5 -10
  309. package/dist/utils/Wrap.js +7 -11
  310. package/dist/utils/colors.stories.js +16 -20
  311. package/dist/utils/createGeminiUrl.js +6 -10
  312. package/dist/utils/flattenChildren.js +5 -9
  313. package/dist/utils/formatLargeNumber.js +1 -5
  314. package/dist/utils/formatLargeNumbers.tests.js +8 -10
  315. package/dist/utils/hooks/index.js +4 -20
  316. package/dist/utils/hooks/useColor.js +2 -6
  317. package/dist/utils/hooks/useMeasure.js +4 -8
  318. package/dist/utils/hooks/useScreenDimensions.js +11 -16
  319. package/dist/utils/hooks/useSpace.js +2 -6
  320. package/dist/utils/hooks/useTheme.js +6 -10
  321. package/dist/utils/normalizeText.js +1 -5
  322. package/dist/utils/space.stories.js +9 -13
  323. package/dist/utils/tests/renderWithWrappers.js +7 -12
  324. package/dist/utils/text.js +9 -13
  325. package/dist/utils/types.js +1 -2
  326. package/dist/utils/webTokensToMobile.js +4 -9
  327. package/package.json +14 -14
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useTextStyleForPalette = exports.useFontFamilyFor = void 0;
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 } = (0, useTheme_1.useTheme)();
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
- "use strict";
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("./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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useToolTipContext = exports.ToolTip = exports.ToolTipContext = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const lodash_1 = require("lodash");
6
- const react_1 = require("react");
7
- const react_native_1 = require("react-native");
8
- const ToolTipFlyout_1 = require("./ToolTipFlyout");
9
- const TriangleDown_1 = require("../../svgs/TriangleDown");
10
- const useScreenDimensions_1 = require("../../utils/hooks/useScreenDimensions");
11
- const useTheme_1 = require("../../utils/hooks/useTheme");
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 } = (0, useTheme_1.useTheme)();
38
- const mWidth = (0, useScreenDimensions_1.useScreenDimensions)().width - space(2) * 2; // 40 accounting for padding 20 on each side of the screen
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] = (0, react_1.useState)(initialToolTipText);
41
- const [childrenDimensions, setChildrenDimensions] = (0, react_1.useState)({ height: 0, width: 0, x: 0 });
42
- const [singleTextDimension, setSingleTextDimension] = (0, react_1.useState)({ height: 0, width: 0 });
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] = (0, react_1.useState)(0);
45
- const childrenRef = (0, react_1.useRef)(null);
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 ((0, jsx_runtime_1.jsxs)(exports.ToolTipContext.Provider, { value: {
54
+ return (_jsxs(ToolTipContext.Provider, { value: {
58
55
  dismissToolTip,
59
56
  setToolTip,
60
- }, children: [!!enabled && position === "TOP" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ToolTipFlyout_1.ToolTipFlyout, { containerStyle: {
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 && ((0, jsx_runtime_1.jsx)(TriangleDown_1.TriangleDown, { style: {
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
- } }))] })), (0, jsx_runtime_1.jsx)(react_native_1.View, { ref: childrenRef, onLayout: (event) => {
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" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ToolTipFlyout_1.ToolTipFlyout, { containerStyle: {
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 && ((0, jsx_runtime_1.jsx)(TriangleDown_1.TriangleDown, { style: {
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 && ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: { position: "absolute", opacity: 0 }, onLayout: ({ nativeEvent }) => {
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: (0, jsx_runtime_1.jsx)(ToolTipFlyout_1.ToolTipTextContainer, { text: "x" }) }))] }));
87
+ }, children: _jsx(ToolTipTextContainer, { text: "x" }) }))] }));
91
88
  };
92
- exports.ToolTip = ToolTip;
93
- const useToolTipContext = () => {
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const react_native_1 = require("@storybook/react-native");
5
- const ToolTip_1 = require("./ToolTip");
6
- const Button_1 = require("../Button");
7
- const Flex_1 = require("../Flex");
8
- const Text_1 = require("../Text");
9
- (0, react_native_1.storiesOf)("ToolTip", module)
10
- .add("Simple ToolTip", () => ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignSelf: "center", mt: "200px", alignItems: "center", flexWrap: "wrap", children: (0, jsx_runtime_1.jsx)(ToolTip_1.ToolTip, { initialToolTipText: "Tap to dismiss me", position: "TOP", tapToDismiss: true, children: (0, jsx_runtime_1.jsx)(Text_1.Text, { weight: "medium", children: "I am a Text" }) }) })))
11
- .add("Bottom ToolTip", () => ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignSelf: "center", mt: "200px", flexWrap: "wrap", children: (0, jsx_runtime_1.jsx)(ToolTip_1.ToolTip, { initialToolTipText: "Bottom tooltip", position: "BOTTOM", tapToDismiss: true, children: (0, jsx_runtime_1.jsx)(Text_1.Text, { weight: "medium", children: "I am a Text" }) }) })))
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const ToolTip_1 = require("./ToolTip");
5
- const hooks_1 = require("../../utils/hooks");
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 } = (0, renderWithWrappers_1.renderWithWrappers)((0, jsx_runtime_1.jsx)(hooks_1.ScreenDimensionsProvider, { children: (0, jsx_runtime_1.jsx)(ToolTip_1.ToolTip, { enabled: true, testID: "flyout", initialToolTipText: "Words", children: (0, jsx_runtime_1.jsx)(Text_1.Text, { children: "Text" }) }) }));
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 } = (0, renderWithWrappers_1.renderWithWrappers)((0, jsx_runtime_1.jsx)(hooks_1.ScreenDimensionsProvider, { children: (0, jsx_runtime_1.jsx)(ToolTip_1.ToolTip, { enabled: false, testID: "flyout", initialToolTipText: "Words", children: (0, jsx_runtime_1.jsx)(Text_1.Text, { children: "Text" }) }) }));
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
- "use strict";
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 __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 = (0, react_native_reanimated_1.useSharedValue)(initialBoxDimensions);
37
- const animationStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
10
+ const boxDimensions = useSharedValue(initialBoxDimensions);
11
+ const animationStyle = useAnimatedStyle(() => {
38
12
  return {
39
- height: (0, react_native_reanimated_1.withTiming)(boxDimensions.value.height, {
13
+ height: withTiming(boxDimensions.value.height, {
40
14
  duration: 500,
41
15
  }),
42
- width: (0, react_native_reanimated_1.withTiming)(boxDimensions.value.width, {
16
+ width: withTiming(boxDimensions.value.width, {
43
17
  duration: 500,
44
18
  }),
45
19
  };
46
20
  });
47
- (0, react_1.useEffect)(() => {
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 = (0, useColor_1.useColor)();
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 ((0, jsx_runtime_1.jsx)(react_native_1.TouchableWithoutFeedback, { onPress: onPress, testID: testID, children: (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [
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: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { justifyContent: "center", alignItems: "center", bg: "black100", children: (0, jsx_runtime_1.jsx)(exports.ToolTipTextContainer, { text: text }) }) }) }));
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 = (0, useColor_1.useColor)();
86
- return ((0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "xs", color: color("white100"), pb: 0.5, children: text }));
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
- "use strict";
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
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Touchable = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
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 = (0, useColor_1.useColor)();
22
- const inner = react_1.default.Children.count(children) === 1 ? children : (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: flex, children: children });
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
- react_native_haptic_feedback_1.default.trigger(haptic === true ? "impactLight" : haptic);
22
+ Haptic.trigger(haptic === true ? "impactLight" : haptic);
29
23
  }
30
24
  onPress(evt);
31
25
  };
32
- return noFeedback ? ((0, jsx_runtime_1.jsx)(react_native_1.TouchableWithoutFeedback, { ...props, onPress: onPressWrapped, children: inner })) : ((0, jsx_runtime_1.jsx)(react_native_1.TouchableHighlight, { underlayColor: underlayColor ?? "transparent", activeOpacity: constants_1.DEFAULT_ACTIVE_OPACITY, ...props, onPress: onPressWrapped, children: inner }));
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Examples = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const Touchable_1 = require("./Touchable");
6
- const helpers_1 = require("../../storybook/helpers");
7
- const svgs_1 = require("../../svgs");
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: Touchable_1.Touchable,
9
+ component: Touchable,
13
10
  };
14
- const Examples = () => ((0, jsx_runtime_1.jsxs)(helpers_1.List, { children: [(0, jsx_runtime_1.jsx)(Touchable_1.Touchable, { children: (0, jsx_runtime_1.jsx)(Text_1.Text, { children: "This is a text wrapped in a `Touchable`." }) }), (0, jsx_runtime_1.jsx)(Touchable_1.Touchable, { children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { width: 200, alignItems: "center", borderColor: "red", borderWidth: 1, children: [(0, jsx_runtime_1.jsx)(svgs_1.TrashIcon, {}), (0, jsx_runtime_1.jsx)(Text_1.Text, { children: "This is a cell with an icon and a text, wrapped in a `Touchable`." })] }) })] }));
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TouchableHighlightColor = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
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] = (0, react_1.useState)(false);
6
+ const [highlighted, setHighlighted] = useState(false);
10
7
  const color = highlighted ? activeColor : normalColor;
11
- return ((0, jsx_runtime_1.jsx)(Touchable_1.Touchable, { noFeedback: true, activeOpacity: activeOpacity, onPressIn: (event) => {
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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 react_native_1.Animated.Value(defaultScale);
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
- react_native_1.Animated.spring(scaleAnimation, { ...ANIMATION_DEFAULTS, toValue: activeScale }).start();
12
+ Animated.spring(scaleAnimation, { ...ANIMATION_DEFAULTS, toValue: activeScale }).start();
16
13
  onPressIn(event);
17
14
  };
18
15
  const handlePressOut = (event) => {
19
- react_native_1.Animated.spring(scaleAnimation, { ...ANIMATION_DEFAULTS, toValue: defaultScale }).start();
16
+ Animated.spring(scaleAnimation, { ...ANIMATION_DEFAULTS, toValue: defaultScale }).start();
20
17
  onPressOut(event);
21
18
  };
22
- return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableWithoutFeedback, { onPressIn: handlePressIn, onPressOut: handlePressOut, ...restProps, children: (0, jsx_runtime_1.jsx)(react_native_1.Animated.View, { style: [style, { transform: [{ scale: scaleAnimation }] }], children: children }) }));
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
- "use strict";
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("./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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const react_native_1 = require("@storybook/react-native");
5
- const _1 = require("./");
6
- const helpers_1 = require("../../storybook/helpers");
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VisualClueDot = void 0;
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 = (0, useColor_1.useColor)();
10
- return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { style: {
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VisualClueText = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const useColor_1 = require("../../utils/hooks/useColor");
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 = (0, useColor_1.useColor)();
13
- return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { width: 0, overflow: "visible", children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { width: 55, justifyContent: "center", children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { style: {
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: (0, jsx_runtime_1.jsx)(PopIn_1.PopIn, { children: (0, jsx_runtime_1.jsx)(Text_1.Text, { style: { fontSize: 12, color: colors("blue100") }, children: "New" }) }) }) }) }));
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
- "use strict";
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("./VisualClueText"), exports);
18
- __exportStar(require("./VisualClueDot"), exports);
1
+ export * from "./VisualClueText";
2
+ export * from "./VisualClueDot";