@artsy/palette-mobile 23.14.0 → 24.0.0

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 (220) hide show
  1. package/dist/Theme.js +16 -11
  2. package/dist/animation/CssTransition.js +71 -26
  3. package/dist/animation/index.js +17 -1
  4. package/dist/constants.js +12 -8
  5. package/dist/elements/ArtsyKeyboardAvoidingView/ArtsyKeyboardAvoidingView.js +116 -69
  6. package/dist/elements/ArtsyKeyboardAvoidingView/index.js +17 -1
  7. package/dist/elements/Autocomplete/Autocomplete.js +32 -23
  8. package/dist/elements/Autocomplete/Autocomplete.tests.js +128 -56
  9. package/dist/elements/Autocomplete/index.js +17 -1
  10. package/dist/elements/Avatar/Avatar.js +20 -15
  11. package/dist/elements/Avatar/Avatar.stories.js +29 -15
  12. package/dist/elements/Avatar/Avatar.tests.js +12 -10
  13. package/dist/elements/Avatar/index.js +17 -1
  14. package/dist/elements/BackButton/BackButton.js +16 -9
  15. package/dist/elements/BackButton/BackButton.stories.js +12 -8
  16. package/dist/elements/BackButton/index.js +17 -1
  17. package/dist/elements/Banner/Banner.js +45 -18
  18. package/dist/elements/Banner/Banner.stories.js +12 -8
  19. package/dist/elements/Banner/index.js +17 -1
  20. package/dist/elements/BorderBox/BorderBox.js +16 -11
  21. package/dist/elements/BorderBox/index.js +17 -1
  22. package/dist/elements/Box/Box.js +16 -14
  23. package/dist/elements/Box/Box.stories.js +21 -15
  24. package/dist/elements/Box/index.js +17 -1
  25. package/dist/elements/Button/Button.js +85 -64
  26. package/dist/elements/Button/Button.stories.js +48 -23
  27. package/dist/elements/Button/CTAButton.js +18 -3
  28. package/dist/elements/Button/FollowButton.js +38 -11
  29. package/dist/elements/Button/LinkButton.js +19 -4
  30. package/dist/elements/Button/colors.js +7 -3
  31. package/dist/elements/Button/index.js +20 -4
  32. package/dist/elements/ButtonNew/Button.js +114 -49
  33. package/dist/elements/ButtonNew/Button.stories.js +64 -38
  34. package/dist/elements/ButtonNew/Button.tests.js +23 -21
  35. package/dist/elements/ButtonNew/CTAButton.js +18 -3
  36. package/dist/elements/ButtonNew/FollowButton.js +36 -9
  37. package/dist/elements/ButtonNew/LinkButton.js +19 -4
  38. package/dist/elements/ButtonNew/colors.js +7 -3
  39. package/dist/elements/ButtonNew/index.js +20 -4
  40. package/dist/elements/Checkbox/Check.js +83 -46
  41. package/dist/elements/Checkbox/Checkbox.js +83 -47
  42. package/dist/elements/Checkbox/Checkbox.stories.js +10 -9
  43. package/dist/elements/Checkbox/index.js +18 -2
  44. package/dist/elements/Chip/Chip.js +23 -18
  45. package/dist/elements/Chip/Chip.stories.js +12 -8
  46. package/dist/elements/Chip/index.js +17 -1
  47. package/dist/elements/ClassTheme/ClassTheme.js +10 -5
  48. package/dist/elements/ClassTheme/index.js +17 -1
  49. package/dist/elements/Collapse/Collapse.js +9 -4
  50. package/dist/elements/Collapse/Collapse.stories.js +13 -9
  51. package/dist/elements/Collapse/index.js +17 -1
  52. package/dist/elements/CollapsibleMenuItem/CollapsibleMenuItem.js +32 -27
  53. package/dist/elements/CollapsibleMenuItem/CollapsibleMenuItem.stories.js +62 -37
  54. package/dist/elements/CollapsibleMenuItem/index.js +17 -1
  55. package/dist/elements/Dialog/Dialog.js +52 -26
  56. package/dist/elements/Dialog/Dialog.stories.js +41 -22
  57. package/dist/elements/Dialog/Dialog.tests.js +33 -31
  58. package/dist/elements/Dialog/index.js +17 -1
  59. package/dist/elements/EntityHeader/EntityHeader.js +42 -15
  60. package/dist/elements/EntityHeader/EntityHeader.stories.js +26 -18
  61. package/dist/elements/EntityHeader/index.js +17 -1
  62. package/dist/elements/Flex/Flex.js +32 -4
  63. package/dist/elements/Flex/index.js +17 -1
  64. package/dist/elements/Header/ArtsyLogoHeader.js +15 -8
  65. package/dist/elements/Header/index.js +17 -1
  66. package/dist/elements/Histogram/Histogram.js +19 -14
  67. package/dist/elements/Histogram/index.js +17 -1
  68. package/dist/elements/Image/Image.js +60 -28
  69. package/dist/elements/Image/Image.stories.js +35 -23
  70. package/dist/elements/Image/__tests__/getImageURL.tests.js +10 -8
  71. package/dist/elements/Image/helpers/getImageURL.js +13 -8
  72. package/dist/elements/Image/index.js +17 -1
  73. package/dist/elements/Input/Input.js +216 -168
  74. package/dist/elements/Input/Input.stories.js +15 -11
  75. package/dist/elements/Input/Input.tests.js +85 -39
  76. package/dist/elements/Input/InputTitle.js +9 -4
  77. package/dist/elements/Input/helpers.js +35 -27
  78. package/dist/elements/Input/index.js +19 -3
  79. package/dist/elements/Input/maskValue.js +25 -9
  80. package/dist/elements/Input/maskValue.tests.js +19 -17
  81. package/dist/elements/Join/Join.js +14 -9
  82. package/dist/elements/Join/index.js +17 -1
  83. package/dist/elements/LazyFlatlist/LazyFlatlist.js +11 -8
  84. package/dist/elements/LazyFlatlist/index.js +18 -2
  85. package/dist/elements/LazyFlatlist/useHasSeenItem.js +19 -12
  86. package/dist/elements/LegacyScreen/LegacyScreen.js +124 -83
  87. package/dist/elements/LegacyScreen/index.js +17 -1
  88. package/dist/elements/LegacyTabs/ContentTabs.js +18 -12
  89. package/dist/elements/LegacyTabs/NavigationalTabs.js +21 -15
  90. package/dist/elements/LegacyTabs/StepTabs.js +25 -19
  91. package/dist/elements/LegacyTabs/Tab.js +31 -19
  92. package/dist/elements/LegacyTabs/TabBarContainer.js +48 -39
  93. package/dist/elements/LegacyTabs/index.js +38 -9
  94. package/dist/elements/List/BulletedItem.js +34 -7
  95. package/dist/elements/List/List.stories.js +12 -8
  96. package/dist/elements/List/index.js +17 -1
  97. package/dist/elements/MeasuredView/MeasuredView.js +18 -12
  98. package/dist/elements/MeasuredView/index.js +17 -1
  99. package/dist/elements/MenuItem/MenuItem.js +14 -9
  100. package/dist/elements/MenuItem/MenuItem.stories.js +9 -5
  101. package/dist/elements/MenuItem/index.js +17 -1
  102. package/dist/elements/Message/Message.js +35 -19
  103. package/dist/elements/Message/Message.stories.d.ts +1 -1
  104. package/dist/elements/Message/Message.stories.js +23 -17
  105. package/dist/elements/Message/Message.tests.js +38 -36
  106. package/dist/elements/Message/index.js +17 -1
  107. package/dist/elements/Pill/Pill.js +116 -138
  108. package/dist/elements/Pill/Pill.stories.js +28 -20
  109. package/dist/elements/Pill/Pill.tests.js +15 -13
  110. package/dist/elements/Pill/index.js +17 -1
  111. package/dist/elements/PopIn/PopIn.js +13 -8
  112. package/dist/elements/PopIn/index.js +17 -1
  113. package/dist/elements/Popover/Popover.js +45 -15
  114. package/dist/elements/Popover/Popover.stories.js +25 -19
  115. package/dist/elements/Popover/index.js +17 -1
  116. package/dist/elements/ProgressBar/ProgressBar.js +68 -23
  117. package/dist/elements/ProgressBar/ProgressBar.stories.js +11 -7
  118. package/dist/elements/ProgressBar/ProgressBar.tests.js +48 -23
  119. package/dist/elements/ProgressBar/index.js +17 -1
  120. package/dist/elements/Radio/RadioButton.js +80 -44
  121. package/dist/elements/Radio/RadioButton.stories.js +17 -13
  122. package/dist/elements/Radio/RadioDot.js +31 -15
  123. package/dist/elements/Radio/index.js +7 -2
  124. package/dist/elements/Screen/Background.js +10 -3
  125. package/dist/elements/Screen/Body.js +37 -10
  126. package/dist/elements/Screen/BottomView.js +17 -9
  127. package/dist/elements/Screen/FloatingHeader.js +36 -9
  128. package/dist/elements/Screen/FullWidthDivider.js +20 -5
  129. package/dist/elements/Screen/FullWidthItem.js +20 -5
  130. package/dist/elements/Screen/Header.js +79 -26
  131. package/dist/elements/Screen/Screen.stories.js +46 -30
  132. package/dist/elements/Screen/ScreenBase.js +39 -11
  133. package/dist/elements/Screen/ScreenFlatList.js +26 -9
  134. package/dist/elements/Screen/ScreenScrollContext.js +21 -15
  135. package/dist/elements/Screen/ScreenScrollView.js +27 -9
  136. package/dist/elements/Screen/StickySubHeader.js +62 -23
  137. package/dist/elements/Screen/constants.js +8 -5
  138. package/dist/elements/Screen/hooks/useListenForScreenScroll.js +13 -9
  139. package/dist/elements/Screen/hooks/useShowLargeTitle.js +19 -14
  140. package/dist/elements/Screen/hooks/useTitleStyles.js +14 -10
  141. package/dist/elements/Screen/index.js +48 -31
  142. package/dist/elements/SearchInput/RoundSearchInput.js +79 -46
  143. package/dist/elements/SearchInput/SearchInput.js +43 -14
  144. package/dist/elements/SearchInput/index.js +18 -2
  145. package/dist/elements/Separator/Separator.js +20 -12
  146. package/dist/elements/Separator/Separator.stories.js +10 -6
  147. package/dist/elements/Separator/ShadowSeparator.js +14 -7
  148. package/dist/elements/Separator/index.js +18 -2
  149. package/dist/elements/SimpleMessage/SimpleMessage.js +47 -11
  150. package/dist/elements/SimpleMessage/index.js +17 -1
  151. package/dist/elements/Skeleton/Skeleton.js +50 -19
  152. package/dist/elements/Skeleton/Skeleton.stories.js +14 -10
  153. package/dist/elements/Skeleton/index.js +17 -1
  154. package/dist/elements/Spacer/Spacer.js +32 -3
  155. package/dist/elements/Spacer/Spacer.stories.js +35 -19
  156. package/dist/elements/Spacer/index.js +17 -1
  157. package/dist/elements/Spinner/Spinner.js +62 -33
  158. package/dist/elements/Spinner/index.js +17 -1
  159. package/dist/elements/Switch/Switch.js +50 -17
  160. package/dist/elements/Switch/Switch.stories.js +31 -14
  161. package/dist/elements/Switch/index.js +17 -1
  162. package/dist/elements/Tabs/SubTabBar.js +29 -20
  163. package/dist/elements/Tabs/TabFlashList.js +24 -12
  164. package/dist/elements/Tabs/TabFlatList.js +24 -12
  165. package/dist/elements/Tabs/TabMasonry.js +24 -12
  166. package/dist/elements/Tabs/TabScrollView.js +27 -14
  167. package/dist/elements/Tabs/Tabs.js +27 -24
  168. package/dist/elements/Tabs/Tabs.stories.js +93 -46
  169. package/dist/elements/Tabs/TabsContainer.js +62 -38
  170. package/dist/elements/Tabs/TabsWithHeader.js +41 -13
  171. package/dist/elements/Tabs/hooks/useListenForTabContentScroll.js +13 -9
  172. package/dist/elements/Tabs/index.js +17 -1
  173. package/dist/elements/Text/LinkText.js +32 -3
  174. package/dist/elements/Text/Text.js +61 -23
  175. package/dist/elements/Text/Text.stories.js +37 -28
  176. package/dist/elements/Text/Text.tests.js +7 -5
  177. package/dist/elements/Text/helpers.js +13 -7
  178. package/dist/elements/Text/index.js +19 -3
  179. package/dist/elements/ToolTip/ToolTip.js +67 -53
  180. package/dist/elements/ToolTip/ToolTip.stories.js +21 -14
  181. package/dist/elements/ToolTip/ToolTip.tests.js +15 -13
  182. package/dist/elements/ToolTip/ToolTipFlyout.js +68 -28
  183. package/dist/elements/ToolTip/index.js +17 -1
  184. package/dist/elements/Touchable/Touchable.js +41 -13
  185. package/dist/elements/Touchable/Touchable.stories.js +13 -9
  186. package/dist/elements/Touchable/TouchableHighlightColor.js +38 -12
  187. package/dist/elements/Touchable/TouchableWithScale.js +38 -11
  188. package/dist/elements/Touchable/index.js +19 -3
  189. package/dist/elements/VisualClue/VisualClue.stories.js +11 -7
  190. package/dist/elements/VisualClue/VisualClueDot.js +24 -14
  191. package/dist/elements/VisualClue/VisualClueText.js +26 -15
  192. package/dist/elements/VisualClue/index.js +18 -2
  193. package/dist/elements/index.js +62 -46
  194. package/dist/index.js +24 -8
  195. package/dist/setupJest.js +11 -6
  196. package/dist/storybook/decorators.js +36 -27
  197. package/dist/storybook/helpers.js +40 -22
  198. package/dist/tokens.js +28 -67
  199. package/dist/types.js +10 -5
  200. package/dist/utils/Wrap.js +16 -8
  201. package/dist/utils/colors.stories.js +31 -25
  202. package/dist/utils/createGeminiUrl.js +28 -22
  203. package/dist/utils/flattenChildren.js +20 -7
  204. package/dist/utils/formatLargeNumber.js +8 -4
  205. package/dist/utils/formatLargeNumbers.tests.js +15 -13
  206. package/dist/utils/hooks/index.js +20 -4
  207. package/dist/utils/hooks/useColor.js +6 -2
  208. package/dist/utils/hooks/useMeasure.js +40 -14
  209. package/dist/utils/hooks/useScreenDimensions.js +31 -20
  210. package/dist/utils/hooks/useSpace.js +6 -2
  211. package/dist/utils/hooks/useTheme.js +31 -23
  212. package/dist/utils/normalizeText.js +11 -6
  213. package/dist/utils/space.stories.js +15 -10
  214. package/dist/utils/tests/flattenChildren.tests.js +8 -6
  215. package/dist/utils/tests/isTestEnvironment.js +5 -1
  216. package/dist/utils/tests/renderWithWrappers.js +15 -7
  217. package/dist/utils/text.js +13 -9
  218. package/dist/utils/types.js +2 -0
  219. package/dist/utils/webTokensToMobile.js +16 -10
  220. package/package.json +30 -36
@@ -1,22 +1,49 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { LockIcon } from "@artsy/icons/native";
3
- import { isValidElement, useMemo } from "react";
4
- import { Text as RNText } from "react-native";
5
- import { bullet } from "../../utils/text";
6
- import { Avatar } from "../Avatar";
7
- import { Flex } from "../Flex";
8
- import { Text } from "../Text";
9
- export const EntityHeader = ({ avatarSize = "xs", FollowButton, RightButton, imageUrl, initials, meta, name, smallVariant = false, displayPrivateIcon, theme = "light", ...restProps }) => {
10
- const rightButton = (RightButton || FollowButton) && (_jsx(Flex, { ml: smallVariant ? 0.5 : 1, flexDirection: "row", alignItems: "center", justifyContent: "flex-end", children: RightButton || FollowButton }));
11
- const headerName = (_jsxs(Flex, { flexDirection: "row", alignItems: "center", children: [_jsx(RNText, { ellipsizeMode: "tail", numberOfLines: 1, children: _jsx(Text, { color: theme === "light" ? "mono100" : "mono0", variant: "sm", lineHeight: "18px", style: { flexShrink: 1 }, children: name }) }), displayPrivateIcon && (_jsx(LockIcon, { ml: "2px", width: 16, height: 16, testID: "lock-icon", fill: theme === "light" ? "mono100" : "mono0" }))] }));
12
- const headerMeta = useMemo(() => {
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.EntityHeader = void 0;
26
+ var jsx_runtime_1 = require("react/jsx-runtime");
27
+ var native_1 = require("@artsy/icons/native");
28
+ var react_1 = require("react");
29
+ var react_native_1 = require("react-native");
30
+ var text_1 = require("../../utils/text");
31
+ var Avatar_1 = require("../Avatar");
32
+ var Flex_1 = require("../Flex");
33
+ var Text_1 = require("../Text");
34
+ var EntityHeader = function (_a) {
35
+ var _b = _a.avatarSize, avatarSize = _b === void 0 ? "xs" : _b, FollowButton = _a.FollowButton, RightButton = _a.RightButton, imageUrl = _a.imageUrl, initials = _a.initials, meta = _a.meta, name = _a.name, _c = _a.smallVariant, smallVariant = _c === void 0 ? false : _c, displayPrivateIcon = _a.displayPrivateIcon, _d = _a.theme, theme = _d === void 0 ? "light" : _d, restProps = __rest(_a, ["avatarSize", "FollowButton", "RightButton", "imageUrl", "initials", "meta", "name", "smallVariant", "displayPrivateIcon", "theme"]);
36
+ var rightButton = (RightButton || FollowButton) && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { ml: smallVariant ? 0.5 : 1, flexDirection: "row", alignItems: "center", justifyContent: "flex-end", children: RightButton || FollowButton }));
37
+ var headerName = ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { ellipsizeMode: "tail", numberOfLines: 1, children: (0, jsx_runtime_1.jsx)(Text_1.Text, { color: theme === "light" ? "mono100" : "mono0", variant: "sm", lineHeight: "18px", style: { flexShrink: 1 }, children: name }) }), displayPrivateIcon && ((0, jsx_runtime_1.jsx)(native_1.LockIcon, { ml: "2px", width: 16, height: 16, testID: "lock-icon", fill: theme === "light" ? "mono100" : "mono0" }))] }));
38
+ var headerMeta = (0, react_1.useMemo)(function () {
13
39
  if (meta) {
14
- if (isValidElement(meta)) {
40
+ if ((0, react_1.isValidElement)(meta)) {
15
41
  return meta;
16
42
  }
17
- return (_jsx(Text, { ellipsizeMode: "tail", numberOfLines: 1, variant: "xs", color: theme === "light" ? "mono60" : "mono0", style: { flexShrink: 1 }, children: meta }));
43
+ return ((0, jsx_runtime_1.jsx)(Text_1.Text, { ellipsizeMode: "tail", numberOfLines: 1, variant: "xs", color: theme === "light" ? "mono60" : "mono0", style: { flexShrink: 1 }, children: meta }));
18
44
  }
19
45
  return null;
20
46
  }, [meta, theme]);
21
- return (_jsxs(Flex, { flexDirection: "row", flexWrap: "nowrap", ...restProps, children: [!!(imageUrl || initials) && (_jsx(Flex, { mr: 1, justifyContent: "center", children: _jsx(Avatar, { size: avatarSize, src: imageUrl, initials: initials, color: theme === "light" ? "mono100" : "mono0" }) })), smallVariant ? (_jsxs(Flex, { flexDirection: "row", justifyContent: "flex-start", flexGrow: 1, alignItems: "center", children: [headerName, _jsx(Text, { variant: "sm", ml: "0.5", color: theme === "light" ? "mono100" : "mono0", children: bullet }), rightButton] })) : (_jsxs(Flex, { justifyContent: "space-between", width: 0, flexGrow: 1, flexDirection: "row", children: [_jsxs(Flex, { alignSelf: "center", flexShrink: 1, children: [headerName, headerMeta] }), rightButton] }))] }));
47
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, __assign({ flexDirection: "row", flexWrap: "nowrap" }, restProps, { children: [!!(imageUrl || initials) && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { mr: 1, justifyContent: "center", children: (0, jsx_runtime_1.jsx)(Avatar_1.Avatar, { size: avatarSize, src: imageUrl, initials: initials, color: theme === "light" ? "mono100" : "mono0" }) })), smallVariant ? ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", justifyContent: "flex-start", flexGrow: 1, alignItems: "center", children: [headerName, (0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "sm", ml: "0.5", color: theme === "light" ? "mono100" : "mono0", children: text_1.bullet }), rightButton] })) : ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { justifyContent: "space-between", width: 0, flexGrow: 1, flexDirection: "row", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignSelf: "center", flexShrink: 1, children: [headerName, headerMeta] }), rightButton] }))] })));
22
48
  };
49
+ exports.EntityHeader = EntityHeader;
@@ -1,25 +1,33 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { EntityHeader } from "./EntityHeader";
3
- import { Box } from "../Box";
4
- import { Button } from "../Button";
5
- import { Text } from "../Text";
6
- export default {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WithPrivateIcon = exports.WithRightButton = exports.VariantSmall = exports.Image = exports.Initials = void 0;
4
+ var jsx_runtime_1 = require("react/jsx-runtime");
5
+ var EntityHeader_1 = require("./EntityHeader");
6
+ var Box_1 = require("../Box");
7
+ var Button_1 = require("../Button");
8
+ var Text_1 = require("../Text");
9
+ exports.default = {
7
10
  title: "EntityHeader",
8
- component: EntityHeader,
11
+ component: EntityHeader_1.EntityHeader,
9
12
  };
10
- const avatarSizes = ["xxs", "xs", "sm", "md"];
11
- export const Initials = () => {
12
- return (_jsxs(Box, { children: [_jsx(Text, { variant: "md", children: "Avatar Sizes" }), _jsx(Box, { mx: 2, children: avatarSizes.map((size) => (_jsxs(Box, { mb: 1, children: [_jsx(Text, { children: size }), _jsx(EntityHeader, { name: "Artist Name", initials: "AN", meta: "Meta stuff", avatarSize: size })] }))) })] }));
13
+ var avatarSizes = ["xxs", "xs", "sm", "md"];
14
+ var Initials = function () {
15
+ return ((0, jsx_runtime_1.jsxs)(Box_1.Box, { children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "md", children: "Avatar Sizes" }), (0, jsx_runtime_1.jsx)(Box_1.Box, { mx: 2, children: avatarSizes.map(function (size) { return ((0, jsx_runtime_1.jsxs)(Box_1.Box, { mb: 1, children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { children: size }), (0, jsx_runtime_1.jsx)(EntityHeader_1.EntityHeader, { name: "Artist Name", initials: "AN", meta: "Meta stuff", avatarSize: size })] })); }) })] }));
13
16
  };
14
- export const Image = () => {
15
- return (_jsxs(Box, { children: [_jsx(Text, { variant: "md", children: "Avatar Sizes" }), _jsx(Box, { mx: 2, children: avatarSizes.map((size) => (_jsxs(Box, { mb: 1, children: [_jsx(Text, { children: size }), _jsx(EntityHeader, { imageUrl: "https://picsum.photos/200/200", name: "Artist Name", initials: "AN", meta: "Meta stuff", avatarSize: size })] }))) })] }));
17
+ exports.Initials = Initials;
18
+ var Image = function () {
19
+ return ((0, jsx_runtime_1.jsxs)(Box_1.Box, { children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "md", children: "Avatar Sizes" }), (0, jsx_runtime_1.jsx)(Box_1.Box, { mx: 2, children: avatarSizes.map(function (size) { return ((0, jsx_runtime_1.jsxs)(Box_1.Box, { mb: 1, children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { children: size }), (0, jsx_runtime_1.jsx)(EntityHeader_1.EntityHeader, { imageUrl: "https://picsum.photos/200/200", name: "Artist Name", initials: "AN", meta: "Meta stuff", avatarSize: size })] })); }) })] }));
16
20
  };
17
- export const VariantSmall = () => {
18
- return (_jsxs(Box, { children: [_jsx(Text, { variant: "md", children: "Avatar Sizes" }), _jsx(Box, { mx: 2, children: avatarSizes.map((size) => (_jsxs(Box, { mb: 1, children: [_jsx(Text, { children: size }), _jsx(EntityHeader, { imageUrl: "https://picsum.photos/200/200", name: "Artist Name", initials: "AN", meta: "Meta stuff", avatarSize: size, smallVariant: true })] }))) })] }));
21
+ exports.Image = Image;
22
+ var VariantSmall = function () {
23
+ return ((0, jsx_runtime_1.jsxs)(Box_1.Box, { children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "md", children: "Avatar Sizes" }), (0, jsx_runtime_1.jsx)(Box_1.Box, { mx: 2, children: avatarSizes.map(function (size) { return ((0, jsx_runtime_1.jsxs)(Box_1.Box, { mb: 1, children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { children: size }), (0, jsx_runtime_1.jsx)(EntityHeader_1.EntityHeader, { imageUrl: "https://picsum.photos/200/200", name: "Artist Name", initials: "AN", meta: "Meta stuff", avatarSize: size, smallVariant: true })] })); }) })] }));
19
24
  };
20
- export const WithRightButton = () => {
21
- return (_jsxs(Box, { children: [_jsx(Text, { variant: "md", children: "Avatar Sizes" }), _jsx(Box, { mx: 2, children: avatarSizes.map((size) => (_jsxs(Box, { mb: 1, children: [_jsx(Text, { children: size }), _jsx(EntityHeader, { imageUrl: "https://picsum.photos/200/200", name: "Artist Name", initials: "AN", meta: "Meta stuff", avatarSize: size, RightButton: _jsx(Button, { size: "small", children: "Right Button" }) })] }))) })] }));
25
+ exports.VariantSmall = VariantSmall;
26
+ var WithRightButton = function () {
27
+ return ((0, jsx_runtime_1.jsxs)(Box_1.Box, { children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "md", children: "Avatar Sizes" }), (0, jsx_runtime_1.jsx)(Box_1.Box, { mx: 2, children: avatarSizes.map(function (size) { return ((0, jsx_runtime_1.jsxs)(Box_1.Box, { mb: 1, children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { children: size }), (0, jsx_runtime_1.jsx)(EntityHeader_1.EntityHeader, { imageUrl: "https://picsum.photos/200/200", name: "Artist Name", initials: "AN", meta: "Meta stuff", avatarSize: size, RightButton: (0, jsx_runtime_1.jsx)(Button_1.Button, { size: "small", children: "Right Button" }) })] })); }) })] }));
22
28
  };
23
- export const WithPrivateIcon = () => {
24
- return (_jsxs(Box, { children: [_jsx(Text, { variant: "md", children: "Avatar Sizes" }), _jsx(Box, { mx: 2, children: avatarSizes.map((size) => (_jsxs(Box, { mb: 1, children: [_jsx(Text, { children: size }), _jsx(EntityHeader, { imageUrl: "https://picsum.photos/200/200", name: "Artist Name", initials: "AN", meta: "Meta stuff", avatarSize: size, displayPrivateIcon: true })] }))) })] }));
29
+ exports.WithRightButton = WithRightButton;
30
+ var WithPrivateIcon = function () {
31
+ return ((0, jsx_runtime_1.jsxs)(Box_1.Box, { children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "md", children: "Avatar Sizes" }), (0, jsx_runtime_1.jsx)(Box_1.Box, { mx: 2, children: avatarSizes.map(function (size) { return ((0, jsx_runtime_1.jsxs)(Box_1.Box, { mb: 1, children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { children: size }), (0, jsx_runtime_1.jsx)(EntityHeader_1.EntityHeader, { imageUrl: "https://picsum.photos/200/200", name: "Artist Name", initials: "AN", meta: "Meta stuff", avatarSize: size, displayPrivateIcon: true })] })); }) })] }));
25
32
  };
33
+ exports.WithPrivateIcon = WithPrivateIcon;
@@ -1 +1,17 @@
1
- export * from "./EntityHeader";
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("./EntityHeader"), exports);
@@ -1,4 +1,32 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import { Box } from "../Box";
4
- export const Flex = forwardRef(({ backgroundColor, ...restProps }, ref) => (_jsx(Box, { backgroundColor: backgroundColor ?? "transparent", ...restProps, ref: ref })));
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.Flex = void 0;
26
+ var jsx_runtime_1 = require("react/jsx-runtime");
27
+ var react_1 = require("react");
28
+ var Box_1 = require("../Box");
29
+ exports.Flex = (0, react_1.forwardRef)(function (_a, ref) {
30
+ var backgroundColor = _a.backgroundColor, restProps = __rest(_a, ["backgroundColor"]);
31
+ return ((0, jsx_runtime_1.jsx)(Box_1.Box, __assign({ backgroundColor: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : "transparent" }, restProps, { ref: ref })));
32
+ });
@@ -1 +1,17 @@
1
- export * from "./Flex";
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("./Flex"), exports);
@@ -1,11 +1,18 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { ArtsyLogoIcon } from "@artsy/icons/native";
3
- import { StyleSheet } from "react-native";
4
- import { Box } from "../Box";
5
- import { Flex } from "../Flex";
6
- import { Spacer } from "../Spacer";
7
- export const ArtsyLogoHeader = ({ shadow = false }) => (_jsxs(_Fragment, { children: [_jsxs(Box, { mt: 2, mb: 1, style: shadow ? styles.boxShadowStyle : {}, children: [_jsx(Flex, { alignItems: "center", children: _jsx(ArtsyLogoIcon, { height: 32, width: 94 }) }), _jsx(Spacer, { x: 1 })] }), _jsx(Spacer, { x: 2 })] }));
8
- const styles = StyleSheet.create({
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArtsyLogoHeader = void 0;
4
+ var jsx_runtime_1 = require("react/jsx-runtime");
5
+ var native_1 = require("@artsy/icons/native");
6
+ var react_native_1 = require("react-native");
7
+ var Box_1 = require("../Box");
8
+ var Flex_1 = require("../Flex");
9
+ var Spacer_1 = require("../Spacer");
10
+ var ArtsyLogoHeader = function (_a) {
11
+ var _b = _a.shadow, shadow = _b === void 0 ? false : _b;
12
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Box_1.Box, { mt: 2, mb: 1, style: shadow ? styles.boxShadowStyle : {}, children: [(0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignItems: "center", children: (0, jsx_runtime_1.jsx)(native_1.ArtsyLogoIcon, { height: 32, width: 94 }) }), (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { x: 1 })] }), (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { x: 2 })] }));
13
+ };
14
+ exports.ArtsyLogoHeader = ArtsyLogoHeader;
15
+ var styles = react_native_1.StyleSheet.create({
9
16
  boxShadowStyle: {
10
17
  shadowColor: "black",
11
18
  shadowOffset: { width: 0, height: 4 },
@@ -1 +1,17 @@
1
- export * from "./ArtsyLogoHeader";
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("./ArtsyLogoHeader"), exports);
@@ -1,23 +1,28 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Box } from "../Box";
3
- import { Flex } from "../Flex";
4
- const BAR_WIDTH = 2;
5
- const BAR_ROUNDNESS = 10;
6
- const isSelected = (value, min, max) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Histogram = void 0;
4
+ var jsx_runtime_1 = require("react/jsx-runtime");
5
+ var Box_1 = require("../Box");
6
+ var Flex_1 = require("../Flex");
7
+ var BAR_WIDTH = 2;
8
+ var BAR_ROUNDNESS = 10;
9
+ var isSelected = function (value, min, max) {
7
10
  return value >= min && value <= max;
8
11
  };
9
- const getPercentByEntity = (maxValue, entityCount) => {
12
+ var getPercentByEntity = function (maxValue, entityCount) {
10
13
  if (maxValue === 0) {
11
14
  return 100;
12
15
  }
13
16
  return (100 / maxValue) * entityCount;
14
17
  };
15
- export const Histogram = ({ bars, selectedRange }) => {
16
- const maxValue = Math.max(...bars.map((bar) => bar.count));
17
- const [min, max] = selectedRange;
18
- return (_jsx(Flex, { height: 110, flexDirection: "row", justifyContent: "space-between", alignItems: "flex-end", children: bars.map((entity, index) => {
19
- const percent = getPercentByEntity(maxValue, entity.count);
20
- const selected = isSelected(entity.value, min, max);
21
- return (_jsx(Box, { height: `${percent}%`, bg: selected ? "blue100" : "mono15", width: BAR_WIDTH, borderTopLeftRadius: BAR_ROUNDNESS, borderTopRightRadius: BAR_ROUNDNESS }, `bar-${index}`));
18
+ var Histogram = function (_a) {
19
+ var bars = _a.bars, selectedRange = _a.selectedRange;
20
+ var maxValue = Math.max.apply(Math, bars.map(function (bar) { return bar.count; }));
21
+ var min = selectedRange[0], max = selectedRange[1];
22
+ return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { height: 110, flexDirection: "row", justifyContent: "space-between", alignItems: "flex-end", children: bars.map(function (entity, index) {
23
+ var percent = getPercentByEntity(maxValue, entity.count);
24
+ var selected = isSelected(entity.value, min, max);
25
+ return ((0, jsx_runtime_1.jsx)(Box_1.Box, { height: "".concat(percent, "%"), bg: selected ? "blue100" : "mono15", width: BAR_WIDTH, borderTopLeftRadius: BAR_ROUNDNESS, borderTopRightRadius: BAR_ROUNDNESS }, "bar-".concat(index)));
22
26
  }) }));
23
27
  };
28
+ exports.Histogram = Histogram;
@@ -1 +1,17 @@
1
- export * from "./Histogram";
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("./Histogram"), exports);
@@ -1,35 +1,65 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import FastImage from "@d11/react-native-fast-image";
3
- import { memo, useState } from "react";
4
- import { Blurhash } from "react-native-blurhash";
5
- import { getImageURL } from "./helpers/getImageURL";
6
- import { useColor } from "../../utils/hooks";
7
- import { useScreenDimensions } from "../../utils/hooks/useScreenDimensions";
8
- import { Flex } from "../Flex";
9
- import { Skeleton, SkeletonBox } from "../Skeleton";
10
- export const Image = memo(({ aspectRatio, width, height, performResize = true, src, style, resizeMode, geminiResizeMode, showLoadingState = false, blurhash, ...flexProps }) => {
11
- const [isLoading, setIsLoading] = useState(true);
12
- const dimensions = useImageDimensions({ aspectRatio, width, height });
13
- const color = useColor();
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.ImageSkeleton = exports.Image = void 0;
29
+ var jsx_runtime_1 = require("react/jsx-runtime");
30
+ var react_native_fast_image_1 = __importDefault(require("@d11/react-native-fast-image"));
31
+ var react_1 = require("react");
32
+ var react_native_blurhash_1 = require("react-native-blurhash");
33
+ var getImageURL_1 = require("./helpers/getImageURL");
34
+ var hooks_1 = require("../../utils/hooks");
35
+ var useScreenDimensions_1 = require("../../utils/hooks/useScreenDimensions");
36
+ var Flex_1 = require("../Flex");
37
+ var Skeleton_1 = require("../Skeleton");
38
+ exports.Image = (0, react_1.memo)(function (_a) {
39
+ var aspectRatio = _a.aspectRatio, width = _a.width, height = _a.height, _b = _a.performResize, performResize = _b === void 0 ? true : _b, src = _a.src, style = _a.style, resizeMode = _a.resizeMode, geminiResizeMode = _a.geminiResizeMode, _c = _a.showLoadingState, showLoadingState = _c === void 0 ? false : _c, blurhash = _a.blurhash, flexProps = __rest(_a, ["aspectRatio", "width", "height", "performResize", "src", "style", "resizeMode", "geminiResizeMode", "showLoadingState", "blurhash"]);
40
+ var _d = (0, react_1.useState)(true), isLoading = _d[0], setIsLoading = _d[1];
41
+ var dimensions = useImageDimensions({ aspectRatio: aspectRatio, width: width, height: height });
42
+ var color = (0, hooks_1.useColor)();
14
43
  if (showLoadingState) {
15
44
  // Keep logic as small as possible here to save on performance
16
- return _jsx(Flex, { backgroundColor: "mono10", ...dimensions, style: { position: "absolute" } });
45
+ return (0, jsx_runtime_1.jsx)(Flex_1.Flex, __assign({ backgroundColor: "mono10" }, dimensions, { style: { position: "absolute" } }));
17
46
  }
18
- return (_jsxs(Flex, { position: "relative", ...flexProps, style: { ...dimensions }, children: [_jsx(FastImage, { style: [
47
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, __assign({ position: "relative" }, flexProps, { style: __assign({}, dimensions), children: [(0, jsx_runtime_1.jsx)(react_native_fast_image_1.default, { style: [
19
48
  dimensions,
20
49
  style,
21
50
  // If we have a blurhash, we don't want to show a background color
22
51
  // That might flash before the image loads
23
52
  { backgroundColor: blurhash ? "transparent" : color("mono30") },
24
- ], resizeMode: resizeMode, onLoadEnd: () => setIsLoading(false), source: {
25
- priority: FastImage.priority.normal,
26
- uri: getImageURL({ src, dimensions, geminiResizeMode, performResize }),
27
- } }), isLoading && (_jsx(Flex, { style: [dimensions, { position: "absolute" }], children: _jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }) }))] }));
53
+ ], resizeMode: resizeMode, onLoadEnd: function () { return setIsLoading(false); }, source: {
54
+ priority: react_native_fast_image_1.default.priority.normal,
55
+ uri: (0, getImageURL_1.getImageURL)({ src: src, dimensions: dimensions, geminiResizeMode: geminiResizeMode, performResize: performResize }),
56
+ } }), isLoading && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { style: [dimensions, { position: "absolute" }], children: (0, jsx_runtime_1.jsx)(exports.ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }) }))] })));
28
57
  });
29
- const useImageDimensions = (props) => {
30
- const screenDimensions = useScreenDimensions();
31
- const imageWidth = props.width ?? screenDimensions.width;
32
- let imageHeight;
58
+ var useImageDimensions = function (props) {
59
+ var _a, _b;
60
+ var screenDimensions = (0, useScreenDimensions_1.useScreenDimensions)();
61
+ var imageWidth = (_a = props.width) !== null && _a !== void 0 ? _a : screenDimensions.width;
62
+ var imageHeight;
33
63
  if (props.height) {
34
64
  imageHeight = props.height;
35
65
  }
@@ -37,18 +67,20 @@ const useImageDimensions = (props) => {
37
67
  if (!props.aspectRatio) {
38
68
  console.error("[Image] Error: `aspectRatio` is required if `height` is not provided.");
39
69
  }
40
- const aspectRatio = props.aspectRatio ?? 1;
70
+ var aspectRatio = (_b = props.aspectRatio) !== null && _b !== void 0 ? _b : 1;
41
71
  imageHeight = imageWidth / aspectRatio;
42
72
  }
43
- const dimensions = {
73
+ var dimensions = {
44
74
  width: imageWidth,
45
75
  height: imageHeight,
46
76
  };
47
77
  return dimensions;
48
78
  };
49
- export const ImageSkeleton = ({ dimensions, blurhash, style }) => {
79
+ var ImageSkeleton = function (_a) {
80
+ var dimensions = _a.dimensions, blurhash = _a.blurhash, style = _a.style;
50
81
  if (!!blurhash) {
51
- return (_jsx(Flex, { backgroundColor: "mono10", ...dimensions, style: style, children: _jsx(Blurhash, { blurhash: blurhash, style: { flex: 1 }, decodeWidth: 16, decodeHeight: 16, decodeAsync: true }) }));
82
+ return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, __assign({ backgroundColor: "mono10" }, dimensions, { style: style, children: (0, jsx_runtime_1.jsx)(react_native_blurhash_1.Blurhash, { blurhash: blurhash, style: { flex: 1 }, decodeWidth: 16, decodeHeight: 16, decodeAsync: true }) })));
52
83
  }
53
- return (_jsx(Flex, { style: style, children: _jsx(Skeleton, { children: _jsx(SkeletonBox, { ...dimensions }) }) }));
84
+ return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { style: style, children: (0, jsx_runtime_1.jsx)(Skeleton_1.Skeleton, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.SkeletonBox, __assign({}, dimensions)) }) }));
54
85
  };
86
+ exports.ImageSkeleton = ImageSkeleton;
@@ -1,44 +1,56 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Image } from "./Image";
3
- import { Flex } from "../Flex";
4
- export default {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WithoutAutomaticResizingBlurhash = exports.WithAspectRatioBlurhash = exports.WithWidthAndHeightBlurhash = exports.WithDefaultFallbackScreenWidthBlurhash = exports.WithPercentageWidthAndHeight = exports.WithoutAutomaticResizing = exports.WithAspectRatio = exports.WithWidthAndHeight = exports.WithDefaultFallbackScreenWidth = void 0;
4
+ var jsx_runtime_1 = require("react/jsx-runtime");
5
+ var Image_1 = require("./Image");
6
+ var Flex_1 = require("../Flex");
7
+ exports.default = {
5
8
  title: "Image",
6
9
  };
7
- export const WithDefaultFallbackScreenWidth = () => (_jsx(Image, { aspectRatio: 0.62, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" }));
8
- WithDefaultFallbackScreenWidth.story = {
10
+ var WithDefaultFallbackScreenWidth = function () { return ((0, jsx_runtime_1.jsx)(Image_1.Image, { aspectRatio: 0.62, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" })); };
11
+ exports.WithDefaultFallbackScreenWidth = WithDefaultFallbackScreenWidth;
12
+ exports.WithDefaultFallbackScreenWidth.story = {
9
13
  name: "With default fallback screen width",
10
14
  };
11
- export const WithWidthAndHeight = () => (_jsx(Image, { width: 250, height: 400, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" }));
12
- WithWidthAndHeight.story = {
15
+ var WithWidthAndHeight = function () { return ((0, jsx_runtime_1.jsx)(Image_1.Image, { width: 250, height: 400, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" })); };
16
+ exports.WithWidthAndHeight = WithWidthAndHeight;
17
+ exports.WithWidthAndHeight.story = {
13
18
  name: "With width and height",
14
19
  };
15
- export const WithAspectRatio = () => (_jsx(Image, { width: 250, aspectRatio: 0.62, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" }));
16
- WithAspectRatio.story = {
20
+ var WithAspectRatio = function () { return ((0, jsx_runtime_1.jsx)(Image_1.Image, { width: 250, aspectRatio: 0.62, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" })); };
21
+ exports.WithAspectRatio = WithAspectRatio;
22
+ exports.WithAspectRatio.story = {
17
23
  name: "With aspect ratio",
18
24
  };
19
- export const WithoutAutomaticResizing = () => (_jsx(Image, { aspectRatio: 0.62, performResize: false, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" }));
20
- WithoutAutomaticResizing.story = {
25
+ var WithoutAutomaticResizing = function () { return ((0, jsx_runtime_1.jsx)(Image_1.Image, { aspectRatio: 0.62, performResize: false, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" })); };
26
+ exports.WithoutAutomaticResizing = WithoutAutomaticResizing;
27
+ exports.WithoutAutomaticResizing.story = {
21
28
  name: "Without automatic resizing",
22
29
  };
23
- export const WithPercentageWidthAndHeight = () => {
24
- return (_jsxs(Flex, { flexDirection: "row", flex: 1, children: [_jsx(Flex, { flex: 1, style: { aspectRatio: 0.69 }, children: _jsx(Image, { src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg", height: 260, width: 180, style: { width: "100%", height: "100%" } }) }), _jsx(Flex, { flex: 1, style: { aspectRatio: 1 }, children: _jsx(Image, { src: "https://i.imgur.com/b9IZinu.gif", width: 200, height: 200, style: { width: "100%", height: "100%" } }) }), _jsx(Flex, { flex: 1, style: { aspectRatio: 1.2 }, children: _jsx(Image, { width: 200, height: 240, src: "https://i.imgur.com/non-existing-image.gif", style: { width: "100%", height: "100%" } }) })] }));
30
+ var WithPercentageWidthAndHeight = function () {
31
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", flex: 1, children: [(0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, style: { aspectRatio: 0.69 }, children: (0, jsx_runtime_1.jsx)(Image_1.Image, { src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg", height: 260, width: 180, style: { width: "100%", height: "100%" } }) }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, style: { aspectRatio: 1 }, children: (0, jsx_runtime_1.jsx)(Image_1.Image, { src: "https://i.imgur.com/b9IZinu.gif", width: 200, height: 200, style: { width: "100%", height: "100%" } }) }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, style: { aspectRatio: 1.2 }, children: (0, jsx_runtime_1.jsx)(Image_1.Image, { width: 200, height: 240, src: "https://i.imgur.com/non-existing-image.gif", style: { width: "100%", height: "100%" } }) })] }));
25
32
  };
26
- WithPercentageWidthAndHeight.story = {
33
+ exports.WithPercentageWidthAndHeight = WithPercentageWidthAndHeight;
34
+ exports.WithPercentageWidthAndHeight.story = {
27
35
  name: "With percentage width and height",
28
36
  };
29
- export const WithDefaultFallbackScreenWidthBlurhash = () => (_jsx(Image, { aspectRatio: 0.62, blurhash: "LXK,+3H#yArKH~bGx:tM.atxM*k9", src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" }));
30
- WithDefaultFallbackScreenWidthBlurhash.story = {
37
+ var WithDefaultFallbackScreenWidthBlurhash = function () { return ((0, jsx_runtime_1.jsx)(Image_1.Image, { aspectRatio: 0.62, blurhash: "LXK,+3H#yArKH~bGx:tM.atxM*k9", src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" })); };
38
+ exports.WithDefaultFallbackScreenWidthBlurhash = WithDefaultFallbackScreenWidthBlurhash;
39
+ exports.WithDefaultFallbackScreenWidthBlurhash.story = {
31
40
  name: "With default fallback screen width + blurhash",
32
41
  };
33
- export const WithWidthAndHeightBlurhash = () => (_jsx(Image, { blurhash: "LXK,+3H#yArKH~bGx:tM.atxM*k9", width: 250, height: 400, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" }));
34
- WithWidthAndHeightBlurhash.story = {
42
+ var WithWidthAndHeightBlurhash = function () { return ((0, jsx_runtime_1.jsx)(Image_1.Image, { blurhash: "LXK,+3H#yArKH~bGx:tM.atxM*k9", width: 250, height: 400, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" })); };
43
+ exports.WithWidthAndHeightBlurhash = WithWidthAndHeightBlurhash;
44
+ exports.WithWidthAndHeightBlurhash.story = {
35
45
  name: "With width and height + blurhash",
36
46
  };
37
- export const WithAspectRatioBlurhash = () => (_jsx(Image, { blurhash: "LXK,+3H#yArKH~bGx:tM.atxM*k9", width: 250, aspectRatio: 0.62, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" }));
38
- WithAspectRatioBlurhash.story = {
47
+ var WithAspectRatioBlurhash = function () { return ((0, jsx_runtime_1.jsx)(Image_1.Image, { blurhash: "LXK,+3H#yArKH~bGx:tM.atxM*k9", width: 250, aspectRatio: 0.62, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" })); };
48
+ exports.WithAspectRatioBlurhash = WithAspectRatioBlurhash;
49
+ exports.WithAspectRatioBlurhash.story = {
39
50
  name: "With aspect ratio + blurhash",
40
51
  };
41
- export const WithoutAutomaticResizingBlurhash = () => (_jsx(Image, { blurhash: "LXK,+3H#yArKH~bGx:tM.atxM*k9", aspectRatio: 0.62, performResize: false, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" }));
42
- WithoutAutomaticResizingBlurhash.story = {
52
+ var WithoutAutomaticResizingBlurhash = function () { return ((0, jsx_runtime_1.jsx)(Image_1.Image, { blurhash: "LXK,+3H#yArKH~bGx:tM.atxM*k9", aspectRatio: 0.62, performResize: false, src: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" })); };
53
+ exports.WithoutAutomaticResizingBlurhash = WithoutAutomaticResizingBlurhash;
54
+ exports.WithoutAutomaticResizingBlurhash.story = {
43
55
  name: "Without automatic resizing + blurhash",
44
56
  };
@@ -1,7 +1,9 @@
1
- import { getImageURL } from "../helpers/getImageURL";
2
- describe("getImageURL", () => {
3
- it("should return the original url if performResize is true", () => {
4
- const url = getImageURL({
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var getImageURL_1 = require("../helpers/getImageURL");
4
+ describe("getImageURL", function () {
5
+ it("should return the original url if performResize is true", function () {
6
+ var url = (0, getImageURL_1.getImageURL)({
5
7
  src: "https://example.com/image.jpg",
6
8
  dimensions: { width: 100, height: 100 },
7
9
  geminiResizeMode: "fill",
@@ -9,8 +11,8 @@ describe("getImageURL", () => {
9
11
  });
10
12
  expect(url).toBe("https://d7hftxdivxxvm.cloudfront.net/?height=200&quality=80&resize_to=fill&src=https%3A%2F%2Fexample.com%2Fimage.jpg&width=200");
11
13
  });
12
- it("should return the original url if performResize is true and the url is already resized", () => {
13
- const url = getImageURL({
14
+ it("should return the original url if performResize is true and the url is already resized", function () {
15
+ var url = (0, getImageURL_1.getImageURL)({
14
16
  src: "https://d7hftxdivxxvm.cloudfront.net/?height=100&quality=80&resize_to=fill&src=https%3A%2F%2Fexample.com%2Fimage.jpg&width=100",
15
17
  dimensions: { width: 100, height: 100 },
16
18
  geminiResizeMode: "fill",
@@ -18,8 +20,8 @@ describe("getImageURL", () => {
18
20
  });
19
21
  expect(url).toBe("https://d7hftxdivxxvm.cloudfront.net/?height=100&quality=80&resize_to=fill&src=https%3A%2F%2Fexample.com%2Fimage.jpg&width=100");
20
22
  });
21
- it("should return the original url if performResize is false", () => {
22
- const url = getImageURL({
23
+ it("should return the original url if performResize is false", function () {
24
+ var url = (0, getImageURL_1.getImageURL)({
23
25
  src: "https://example.com/image.jpg",
24
26
  dimensions: { width: 100, height: 100 },
25
27
  geminiResizeMode: "fill",
@@ -1,17 +1,21 @@
1
- import { PixelRatio } from "react-native";
2
- import { createGeminiUrl, imageAlreadyResized, } from "../../../utils/createGeminiUrl";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getImageURL = void 0;
4
+ var react_native_1 = require("react-native");
5
+ var createGeminiUrl_1 = require("../../../utils/createGeminiUrl");
3
6
  /**
4
7
  * This method retuns a valid image url to be used within an Image Component
5
8
  * It handles the case of resizing the image on the fly using Gemini
6
9
  */
7
- export const getImageURL = ({ src, dimensions, geminiResizeMode, performResize, }) => {
8
- let uri = src;
10
+ var getImageURL = function (_a) {
11
+ var src = _a.src, dimensions = _a.dimensions, geminiResizeMode = _a.geminiResizeMode, performResize = _a.performResize;
12
+ var uri = src;
9
13
  if (performResize) {
10
- if (!imageAlreadyResized(src)) {
11
- uri = createGeminiUrl({
14
+ if (!(0, createGeminiUrl_1.imageAlreadyResized)(src)) {
15
+ uri = (0, createGeminiUrl_1.createGeminiUrl)({
12
16
  imageURL: src,
13
- width: PixelRatio.getPixelSizeForLayoutSize(dimensions.width),
14
- height: PixelRatio.getPixelSizeForLayoutSize(dimensions.height),
17
+ width: react_native_1.PixelRatio.getPixelSizeForLayoutSize(dimensions.width),
18
+ height: react_native_1.PixelRatio.getPixelSizeForLayoutSize(dimensions.height),
15
19
  resizeMode: geminiResizeMode,
16
20
  });
17
21
  }
@@ -23,3 +27,4 @@ export const getImageURL = ({ src, dimensions, geminiResizeMode, performResize,
23
27
  }
24
28
  return uri;
25
29
  };
30
+ exports.getImageURL = getImageURL;