@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,43 +1,48 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CheckmarkFillIcon, ChevronSmallDownIcon, ChevronSmallUpIcon } from "@artsy/icons/native";
3
- import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
4
- import { LayoutAnimation } from "react-native";
5
- import { Collapse } from "../Collapse";
6
- import { Flex } from "../Flex";
7
- import { Text } from "../Text";
8
- import { Touchable } from "../Touchable";
9
- export const CollapsibleMenuItem = forwardRef(({ children, overtitle, title, isExpanded = false, disabled = false, onExpand, onCollapse }, ref) => {
10
- const [isOpen, setIsOpen] = useState(false);
11
- const [isCompleted, setIsCompleted] = useState(false);
12
- const componentRef = useRef(null);
13
- useEffect(() => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CollapsibleMenuItem = void 0;
4
+ var jsx_runtime_1 = require("react/jsx-runtime");
5
+ var native_1 = require("@artsy/icons/native");
6
+ var react_1 = require("react");
7
+ var react_native_1 = require("react-native");
8
+ var Collapse_1 = require("../Collapse");
9
+ var Flex_1 = require("../Flex");
10
+ var Text_1 = require("../Text");
11
+ var Touchable_1 = require("../Touchable");
12
+ exports.CollapsibleMenuItem = (0, react_1.forwardRef)(function (_a, ref) {
13
+ var children = _a.children, overtitle = _a.overtitle, title = _a.title, _b = _a.isExpanded, isExpanded = _b === void 0 ? false : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, onExpand = _a.onExpand, onCollapse = _a.onCollapse;
14
+ var _d = (0, react_1.useState)(false), isOpen = _d[0], setIsOpen = _d[1];
15
+ var _e = (0, react_1.useState)(false), isCompleted = _e[0], setIsCompleted = _e[1];
16
+ var componentRef = (0, react_1.useRef)(null);
17
+ (0, react_1.useEffect)(function () {
14
18
  setIsOpen(isExpanded);
15
19
  }, []);
16
- useImperativeHandle(ref, () => ({
17
- collapse(onAnimationEnd) {
18
- LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut, onAnimationEnd);
20
+ (0, react_1.useImperativeHandle)(ref, function () { return ({
21
+ collapse: function (onAnimationEnd) {
22
+ react_native_1.LayoutAnimation.configureNext(react_native_1.LayoutAnimation.Presets.easeInEaseOut, onAnimationEnd);
19
23
  setIsOpen(false);
20
24
  },
21
- expand(onAnimationEnd) {
22
- LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut, onAnimationEnd);
25
+ expand: function (onAnimationEnd) {
26
+ react_native_1.LayoutAnimation.configureNext(react_native_1.LayoutAnimation.Presets.easeInEaseOut, onAnimationEnd);
23
27
  setIsOpen(true);
24
28
  },
25
- completed() {
29
+ completed: function () {
26
30
  setIsCompleted(true);
27
31
  },
28
- isExpanded() {
32
+ isExpanded: function () {
29
33
  return isOpen;
30
34
  },
31
- offsetTop: () => {
32
- return new Promise((resolve) => {
33
- componentRef.current?.measureInWindow((_, h) => {
35
+ offsetTop: function () {
36
+ return new Promise(function (resolve) {
37
+ var _a;
38
+ (_a = componentRef.current) === null || _a === void 0 ? void 0 : _a.measureInWindow(function (_, h) {
34
39
  resolve(h);
35
40
  });
36
41
  });
37
42
  },
38
- }), [isOpen]);
39
- return (_jsxs(Flex, { ref: componentRef, collapsable: false, children: [_jsxs(Touchable, { accessibilityRole: "button", accessibilityLabel: "Collapsible Element", accessibilityState: { disabled }, accessibilityHint: "Tap to " + (isOpen ? "collapse" : "expand"), onPress: () => {
43
+ }); }, [isOpen]);
44
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { ref: componentRef, collapsable: false, children: [(0, jsx_runtime_1.jsxs)(Touchable_1.Touchable, { accessibilityRole: "button", accessibilityLabel: "Collapsible Element", accessibilityState: { disabled: disabled }, accessibilityHint: "Tap to " + (isOpen ? "collapse" : "expand"), onPress: function () {
40
45
  setIsOpen(!isOpen);
41
- isOpen ? onCollapse?.() : onExpand?.();
42
- }, disabled: disabled, children: [!!overtitle && (_jsx(Text, { variant: "sm", color: disabled ? "mono30" : "mono100", children: overtitle })), _jsxs(Flex, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", children: [_jsx(Text, { variant: "lg", color: disabled ? "mono30" : "mono100", style: { maxWidth: "90%" }, children: title }), _jsxs(Flex, { flexDirection: "row", alignItems: "center", children: [!!isCompleted && (_jsx(CheckmarkFillIcon, { fill: "green100", height: 24, width: 24, style: { marginRight: 5 } })), isOpen ? (_jsx(ChevronSmallUpIcon, { fill: disabled ? "mono30" : "mono60" })) : (_jsx(ChevronSmallDownIcon, { fill: disabled ? "mono30" : "mono60" }))] })] })] }), _jsx(Collapse, { opened: isOpen, children: children })] }));
46
+ isOpen ? onCollapse === null || onCollapse === void 0 ? void 0 : onCollapse() : onExpand === null || onExpand === void 0 ? void 0 : onExpand();
47
+ }, disabled: disabled, children: [!!overtitle && ((0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "sm", color: disabled ? "mono30" : "mono100", children: overtitle })), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "lg", color: disabled ? "mono30" : "mono100", style: { maxWidth: "90%" }, children: title }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", alignItems: "center", children: [!!isCompleted && ((0, jsx_runtime_1.jsx)(native_1.CheckmarkFillIcon, { fill: "green100", height: 24, width: 24, style: { marginRight: 5 } })), isOpen ? ((0, jsx_runtime_1.jsx)(native_1.ChevronSmallUpIcon, { fill: disabled ? "mono30" : "mono60" })) : ((0, jsx_runtime_1.jsx)(native_1.ChevronSmallDownIcon, { fill: disabled ? "mono30" : "mono60" }))] })] })] }), (0, jsx_runtime_1.jsx)(Collapse_1.Collapse, { opened: isOpen, children: children })] }));
43
48
  });
@@ -1,32 +1,54 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useRef, useState } from "react";
3
- import { ScrollView, View } from "react-native";
4
- import { CollapsibleMenuItem } from "./CollapsibleMenuItem";
5
- import { Button } from "../Button";
6
- import { Flex } from "../Flex";
7
- import { Join } from "../Join";
8
- import { Separator } from "../Separator";
9
- import { Spacer } from "../Spacer";
10
- import { Text } from "../Text";
11
- export const ArtworkDetails = ({ handlePress }) => {
12
- return (_jsxs(Flex, { backgroundColor: "peachpuff", p: 1, mt: 1, children: [_jsx(Text, { children: "ArtworkDetails content" }), _jsx(Spacer, { y: 1 }), _jsx(CTAButton, { text: "Save & Continue", onPress: handlePress })] }));
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
13
10
  };
14
- export const UploadPhotos = ({ handlePress }) => {
15
- return (_jsxs(Flex, { backgroundColor: "peachpuff", p: 1, mt: 1, children: [_jsx(Text, { children: "Upload Photos content" }), _jsx(Spacer, { y: 1 }), _jsx(CTAButton, { text: "Save & Continue", onPress: handlePress })] }));
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CollapseCollapseItems = exports.ComponentWithCollapsibleMenu = exports.DisplayContent = exports.ContactInformation = exports.UploadPhotos = exports.ArtworkDetails = void 0;
13
+ var jsx_runtime_1 = require("react/jsx-runtime");
14
+ var react_1 = require("react");
15
+ var react_native_1 = require("react-native");
16
+ var CollapsibleMenuItem_1 = require("./CollapsibleMenuItem");
17
+ var Button_1 = require("../Button");
18
+ var Flex_1 = require("../Flex");
19
+ var Join_1 = require("../Join");
20
+ var Separator_1 = require("../Separator");
21
+ var Spacer_1 = require("../Spacer");
22
+ var Text_1 = require("../Text");
23
+ var ArtworkDetails = function (_a) {
24
+ var handlePress = _a.handlePress;
25
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { backgroundColor: "peachpuff", p: 1, mt: 1, children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { children: "ArtworkDetails content" }), (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { y: 1 }), (0, jsx_runtime_1.jsx)(CTAButton, { text: "Save & Continue", onPress: handlePress })] }));
16
26
  };
17
- export const ContactInformation = ({ handlePress }) => {
18
- return (_jsxs(Flex, { backgroundColor: "peachpuff", p: 1, mt: 1, children: [_jsx(Text, { children: "ContactInformation content" }), _jsx(Spacer, { y: 1 }), _jsx(CTAButton, { text: "Submit Artwork", onPress: handlePress })] }));
27
+ exports.ArtworkDetails = ArtworkDetails;
28
+ var UploadPhotos = function (_a) {
29
+ var handlePress = _a.handlePress;
30
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { backgroundColor: "peachpuff", p: 1, mt: 1, children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { children: "Upload Photos content" }), (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { y: 1 }), (0, jsx_runtime_1.jsx)(CTAButton, { text: "Save & Continue", onPress: handlePress })] }));
19
31
  };
20
- const CTAButton = ({ onPress, text }) => (_jsx(Button, { block: true, haptic: true, maxWidth: 540, onPress: onPress, children: text }));
21
- export const DisplayContent = () => {
22
- return (_jsx(View, { style: { backgroundColor: `rgba(255,145,125,.3)`, padding: 20, marginTop: 20 }, children: _jsx(Text, { children: "This is the collapsible menu content" }) }));
32
+ exports.UploadPhotos = UploadPhotos;
33
+ var ContactInformation = function (_a) {
34
+ var handlePress = _a.handlePress;
35
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { backgroundColor: "peachpuff", p: 1, mt: 1, children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { children: "ContactInformation content" }), (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { y: 1 }), (0, jsx_runtime_1.jsx)(CTAButton, { text: "Submit Artwork", onPress: handlePress })] }));
23
36
  };
24
- export const ComponentWithCollapsibleMenu = () => {
25
- const items = [
37
+ exports.ContactInformation = ContactInformation;
38
+ var CTAButton = function (_a) {
39
+ var onPress = _a.onPress, text = _a.text;
40
+ return ((0, jsx_runtime_1.jsx)(Button_1.Button, { block: true, haptic: true, maxWidth: 540, onPress: onPress, children: text }));
41
+ };
42
+ var DisplayContent = function () {
43
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: { backgroundColor: "rgba(255,145,125,.3)", padding: 20, marginTop: 20 }, children: (0, jsx_runtime_1.jsx)(Text_1.Text, { children: "This is the collapsible menu content" }) }));
44
+ };
45
+ exports.DisplayContent = DisplayContent;
46
+ var ComponentWithCollapsibleMenu = function () {
47
+ var items = [
26
48
  {
27
49
  overtitle: "Optional overtitle",
28
50
  title: "Artwork Details",
29
- Content: (_jsx(ArtworkDetails, { handlePress: () => {
51
+ Content: ((0, jsx_runtime_1.jsx)(exports.ArtworkDetails, { handlePress: function () {
30
52
  expandCollapsibleMenuContent(1);
31
53
  enableStep(1);
32
54
  } })),
@@ -34,7 +56,7 @@ export const ComponentWithCollapsibleMenu = () => {
34
56
  {
35
57
  overtitle: "Optional overtitle",
36
58
  title: "Upload Photos",
37
- Content: (_jsx(UploadPhotos, { handlePress: () => {
59
+ Content: ((0, jsx_runtime_1.jsx)(exports.UploadPhotos, { handlePress: function () {
38
60
  expandCollapsibleMenuContent(2);
39
61
  enableStep(2);
40
62
  } })),
@@ -42,22 +64,22 @@ export const ComponentWithCollapsibleMenu = () => {
42
64
  {
43
65
  overtitle: "Optional overtitle",
44
66
  title: "Contact Information",
45
- Content: (_jsx(ContactInformation, { handlePress: () => {
67
+ Content: ((0, jsx_runtime_1.jsx)(exports.ContactInformation, { handlePress: function () {
46
68
  // navigation.navigate("ArtworkSubmittedScreen")
47
69
  // do nothing
48
70
  } })),
49
71
  },
50
72
  ];
51
- const TOTAL_STEPS = items.length;
52
- const [validSteps, setValidSteps] = useState([true, ...new Array(TOTAL_STEPS - 1).fill(false)]);
53
- const stepsRefs = useRef(new Array(TOTAL_STEPS).fill(null)).current;
54
- const enableStep = (stepIndex) => {
55
- const newValidSteps = [...validSteps];
73
+ var TOTAL_STEPS = items.length;
74
+ var _a = (0, react_1.useState)(__spreadArray([true], new Array(TOTAL_STEPS - 1).fill(false), true)), validSteps = _a[0], setValidSteps = _a[1];
75
+ var stepsRefs = (0, react_1.useRef)(new Array(TOTAL_STEPS).fill(null)).current;
76
+ var enableStep = function (stepIndex) {
77
+ var newValidSteps = __spreadArray([], validSteps, true);
56
78
  newValidSteps[stepIndex] = true;
57
79
  setValidSteps(newValidSteps);
58
80
  };
59
- const expandCollapsibleMenuContent = (indexToExpand) => {
60
- items.forEach((_, index) => {
81
+ var expandCollapsibleMenuContent = function (indexToExpand) {
82
+ items.forEach(function (_, index) {
61
83
  if (indexToExpand !== index) {
62
84
  stepsRefs[index].collapse();
63
85
  }
@@ -69,20 +91,22 @@ export const ComponentWithCollapsibleMenu = () => {
69
91
  }
70
92
  });
71
93
  };
72
- return (_jsx(View, { style: { margin: 20 }, children: _jsx(Flex, { children: _jsxs(ScrollView, { contentContainerStyle: {
94
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: { margin: 20 }, children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { children: (0, jsx_runtime_1.jsxs)(react_native_1.ScrollView, { contentContainerStyle: {
73
95
  paddingVertical: 20,
74
96
  paddingHorizontal: 20,
75
97
  justifyContent: "center",
76
- }, children: [_jsx(Spacer, { y: 4 }), _jsx(Join, { separator: _jsx(Separator, { my: 2, marginTop: "40", marginBottom: "20" }), children: items.map(({ overtitle, title, Content }, index) => {
77
- const disabled = !validSteps[index];
78
- return (_jsx(CollapsibleMenuItem, { overtitle: overtitle, title: title, onExpand: () => expandCollapsibleMenuContent(index), isExpanded: index === 0, disabled: disabled, ref: (ref) => {
98
+ }, children: [(0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { y: 4 }), (0, jsx_runtime_1.jsx)(Join_1.Join, { separator: (0, jsx_runtime_1.jsx)(Separator_1.Separator, { my: 2, marginTop: "40", marginBottom: "20" }), children: items.map(function (_a, index) {
99
+ var overtitle = _a.overtitle, title = _a.title, Content = _a.Content;
100
+ var disabled = !validSteps[index];
101
+ return ((0, jsx_runtime_1.jsx)(CollapsibleMenuItem_1.CollapsibleMenuItem, { overtitle: overtitle, title: title, onExpand: function () { return expandCollapsibleMenuContent(index); }, isExpanded: index === 0, disabled: disabled, ref: function (ref) {
79
102
  if (ref) {
80
103
  stepsRefs[index] = ref;
81
104
  }
82
105
  }, children: Content }, index));
83
106
  }) })] }) }) }));
84
107
  };
85
- export default {
108
+ exports.ComponentWithCollapsibleMenu = ComponentWithCollapsibleMenu;
109
+ exports.default = {
86
110
  title: "Collapsible Menu ",
87
111
  excludeStories: [
88
112
  "ArtworkDetails",
@@ -92,4 +116,5 @@ export default {
92
116
  "ComponentWithCollapsibleMenu",
93
117
  ],
94
118
  };
95
- export const CollapseCollapseItems = () => (_jsx(_Fragment, { children: _jsx(ComponentWithCollapsibleMenu, {}) }));
119
+ var CollapseCollapseItems = function () { return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(exports.ComponentWithCollapsibleMenu, {}) })); };
120
+ exports.CollapseCollapseItems = CollapseCollapseItems;
@@ -1 +1,17 @@
1
- export * from "./CollapsibleMenuItem";
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("./CollapsibleMenuItem"), exports);
@@ -1,56 +1,81 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useRef, useState } from "react";
3
- import { Animated, Modal, ScrollView, StyleSheet, TouchableWithoutFeedback } from "react-native";
4
- import { SafeAreaView } from "react-native-safe-area-context";
5
- import { useTheme } from "../../utils/hooks/useTheme";
6
- import { Button } from "../Button";
7
- import { Flex } from "../Flex";
8
- import { Text } from "../Text";
9
- export const Dialog = (props) => {
10
- const { isVisible, title, detail, primaryCta, secondaryCta, onBackgroundPress, ...other } = props;
11
- const [visible, setVisible] = useState(isVisible);
12
- const { space, color } = useTheme();
13
- const value = useRef(new Animated.Value(Number(isVisible))).current;
14
- const fadeIn = () => {
15
- return new Promise((resolve) => {
16
- Animated.timing(value, {
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.Dialog = void 0;
26
+ var jsx_runtime_1 = require("react/jsx-runtime");
27
+ var react_1 = require("react");
28
+ var react_native_1 = require("react-native");
29
+ var react_native_safe_area_context_1 = require("react-native-safe-area-context");
30
+ var useTheme_1 = require("../../utils/hooks/useTheme");
31
+ var Button_1 = require("../Button");
32
+ var Flex_1 = require("../Flex");
33
+ var Text_1 = require("../Text");
34
+ var Dialog = function (props) {
35
+ var isVisible = props.isVisible, title = props.title, detail = props.detail, primaryCta = props.primaryCta, secondaryCta = props.secondaryCta, onBackgroundPress = props.onBackgroundPress, other = __rest(props, ["isVisible", "title", "detail", "primaryCta", "secondaryCta", "onBackgroundPress"]);
36
+ var _a = (0, react_1.useState)(isVisible), visible = _a[0], setVisible = _a[1];
37
+ var _b = (0, useTheme_1.useTheme)(), space = _b.space, color = _b.color;
38
+ var value = (0, react_1.useRef)(new react_native_1.Animated.Value(Number(isVisible))).current;
39
+ var fadeIn = function () {
40
+ return new Promise(function (resolve) {
41
+ react_native_1.Animated.timing(value, {
17
42
  toValue: 1,
18
43
  useNativeDriver: true,
19
44
  duration: 180,
20
45
  }).start(resolve);
21
46
  });
22
47
  };
23
- const fadeOut = () => {
24
- return new Promise((resolve) => {
25
- Animated.timing(value, {
48
+ var fadeOut = function () {
49
+ return new Promise(function (resolve) {
50
+ react_native_1.Animated.timing(value, {
26
51
  toValue: 0,
27
52
  useNativeDriver: true,
28
53
  duration: 150,
29
54
  }).start(resolve);
30
55
  });
31
56
  };
32
- useEffect(() => {
57
+ (0, react_1.useEffect)(function () {
33
58
  if (isVisible) {
34
59
  setVisible(true);
35
60
  fadeIn();
36
61
  }
37
62
  else {
38
- fadeOut().then(() => {
63
+ fadeOut().then(function () {
39
64
  setVisible(false);
40
65
  });
41
66
  }
42
67
  }, [isVisible]);
43
- const backdrop = (_jsx(Animated.View, { style: [
44
- StyleSheet.absoluteFillObject,
68
+ var backdrop = ((0, jsx_runtime_1.jsx)(react_native_1.Animated.View, { style: [
69
+ react_native_1.StyleSheet.absoluteFillObject,
45
70
  { opacity: value, backgroundColor: "rgba(194,194,194,0.5)" },
46
71
  ] }));
47
- return (_jsxs(Modal, { ...other, visible: visible, statusBarTranslucent: true, transparent: true, animationType: "none", children: [!!onBackgroundPress ? (_jsx(TouchableWithoutFeedback, { accessibilityRole: "button", accessibilityLabel: "Dismiss", accessibilityHint: "Dismisses the dialog", testID: "dialog-backdrop", onPress: onBackgroundPress, children: backdrop })) : (backdrop), _jsx(SafeAreaView, { pointerEvents: "box-none", style: {
72
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.Modal, __assign({}, other, { visible: visible, statusBarTranslucent: true, transparent: true, animationType: "none", children: [!!onBackgroundPress ? ((0, jsx_runtime_1.jsx)(react_native_1.TouchableWithoutFeedback, { accessibilityRole: "button", accessibilityLabel: "Dismiss", accessibilityHint: "Dismisses the dialog", testID: "dialog-backdrop", onPress: onBackgroundPress, children: backdrop })) : (backdrop), (0, jsx_runtime_1.jsx)(react_native_safe_area_context_1.SafeAreaView, { pointerEvents: "box-none", style: {
48
73
  flex: 1,
49
74
  justifyContent: "center",
50
75
  alignItems: "center",
51
76
  padding: space(2),
52
77
  backgroundColor: "transparent",
53
- }, children: _jsxs(Animated.View, { style: {
78
+ }, children: (0, jsx_runtime_1.jsxs)(react_native_1.Animated.View, { style: {
54
79
  width: "100%",
55
80
  maxHeight: "100%",
56
81
  opacity: value,
@@ -64,5 +89,6 @@ export const Dialog = (props) => {
64
89
  },
65
90
  shadowOpacity: 1,
66
91
  shadowRadius: 10,
67
- }, children: [_jsx(Text, { testID: "dialog-title", variant: "sm-display", mb: 0.5, mt: 2, mx: 2, children: title }), !!detail && (_jsx(ScrollView, { alwaysBounceVertical: false, contentContainerStyle: { paddingHorizontal: space(2) }, children: _jsx(Text, { testID: "dialog-detail", variant: "sm", color: "mono60", children: detail }) })), _jsxs(Flex, { mt: 2, mb: 2, mx: 2, flexDirection: "row", justifyContent: "flex-end", children: [!!secondaryCta && (_jsx(Button, { size: "small", testID: "dialog-secondary-action-button", variant: "text", onPress: secondaryCta.onPress, children: secondaryCta.text })), _jsx(Button, { size: "small", variant: "fillDark", testID: "dialog-primary-action-button", ml: 2, onPress: primaryCta.onPress, children: primaryCta.text })] })] }) })] }));
92
+ }, children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { testID: "dialog-title", variant: "sm-display", mb: 0.5, mt: 2, mx: 2, children: title }), !!detail && ((0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { alwaysBounceVertical: false, contentContainerStyle: { paddingHorizontal: space(2) }, children: (0, jsx_runtime_1.jsx)(Text_1.Text, { testID: "dialog-detail", variant: "sm", color: "mono60", children: detail }) })), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { mt: 2, mb: 2, mx: 2, flexDirection: "row", justifyContent: "flex-end", children: [!!secondaryCta && ((0, jsx_runtime_1.jsx)(Button_1.Button, { size: "small", testID: "dialog-secondary-action-button", variant: "text", onPress: secondaryCta.onPress, children: secondaryCta.text })), (0, jsx_runtime_1.jsx)(Button_1.Button, { size: "small", variant: "fillDark", testID: "dialog-primary-action-button", ml: 2, onPress: primaryCta.onPress, children: primaryCta.text })] })] }) })] })));
68
93
  };
94
+ exports.Dialog = Dialog;
@@ -1,35 +1,54 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { Dialog } from ".";
4
- import { List } from "../../storybook/helpers";
5
- import { Button } from "../Button";
6
- const DialogDemo = (props) => {
7
- const [visible, setVisible] = useState(false);
8
- return (_jsxs(List, { children: [_jsx(Button, { onPress: () => setVisible(true), children: "Show" }), _jsx(Dialog, { isVisible: visible, title: "Dialog Title", primaryCta: {
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
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.WithBackgroundPressHandler = exports.WithLongDetails = exports.WithDetails = exports.WithSecondaryAction = exports.Default = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_1 = require("react");
17
+ var _1 = require(".");
18
+ var helpers_1 = require("../../storybook/helpers");
19
+ var Button_1 = require("../Button");
20
+ var DialogDemo = function (props) {
21
+ var _a = (0, react_1.useState)(false), visible = _a[0], setVisible = _a[1];
22
+ return ((0, jsx_runtime_1.jsxs)(helpers_1.List, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { onPress: function () { return setVisible(true); }, children: "Show" }), (0, jsx_runtime_1.jsx)(_1.Dialog, __assign({ isVisible: visible, title: "Dialog Title", primaryCta: {
9
23
  text: "OK",
10
- onPress: () => setVisible(false),
11
- }, ...props })] }));
24
+ onPress: function () { return setVisible(false); },
25
+ } }, props))] }));
12
26
  };
13
- export default {
27
+ exports.default = {
14
28
  title: "Dialog",
15
29
  };
16
- export const Default = () => _jsx(DialogDemo, {});
17
- export const WithSecondaryAction = () => (_jsx(DialogDemo, { secondaryCta: {
30
+ var Default = function () { return (0, jsx_runtime_1.jsx)(DialogDemo, {}); };
31
+ exports.Default = Default;
32
+ var WithSecondaryAction = function () { return ((0, jsx_runtime_1.jsx)(DialogDemo, { secondaryCta: {
18
33
  text: "Cancel",
19
- onPress: () => { },
20
- } }));
21
- WithSecondaryAction.story = {
34
+ onPress: function () { },
35
+ } })); };
36
+ exports.WithSecondaryAction = WithSecondaryAction;
37
+ exports.WithSecondaryAction.story = {
22
38
  name: "With secondary action",
23
39
  };
24
- export const WithDetails = () => (_jsx(DialogDemo, { detail: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum." }));
25
- WithDetails.story = {
40
+ var WithDetails = function () { return ((0, jsx_runtime_1.jsx)(DialogDemo, { detail: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum." })); };
41
+ exports.WithDetails = WithDetails;
42
+ exports.WithDetails.story = {
26
43
  name: "With details",
27
44
  };
28
- export const WithLongDetails = () => (_jsx(DialogDemo, { detail: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.".repeat(100) }));
29
- WithLongDetails.story = {
45
+ var WithLongDetails = function () { return ((0, jsx_runtime_1.jsx)(DialogDemo, { detail: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.".repeat(100) })); };
46
+ exports.WithLongDetails = WithLongDetails;
47
+ exports.WithLongDetails.story = {
30
48
  name: "With long details",
31
49
  };
32
- export const WithBackgroundPressHandler = () => _jsx(DialogDemo, { onBackgroundPress: () => { } });
33
- WithBackgroundPressHandler.story = {
50
+ var WithBackgroundPressHandler = function () { return (0, jsx_runtime_1.jsx)(DialogDemo, { onBackgroundPress: function () { } }); };
51
+ exports.WithBackgroundPressHandler = WithBackgroundPressHandler;
52
+ exports.WithBackgroundPressHandler.story = {
34
53
  name: "With background press handler",
35
54
  };
@@ -1,66 +1,68 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { fireEvent, screen, act } from "@testing-library/react-native";
3
- import { Dialog } from "./Dialog";
4
- import { renderWithWrappers } from "../../utils/tests/renderWithWrappers";
5
- describe("Dialog", () => {
6
- beforeEach(() => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var jsx_runtime_1 = require("react/jsx-runtime");
4
+ var react_native_1 = require("@testing-library/react-native");
5
+ var Dialog_1 = require("./Dialog");
6
+ var renderWithWrappers_1 = require("../../utils/tests/renderWithWrappers");
7
+ describe("Dialog", function () {
8
+ beforeEach(function () {
7
9
  jest.useFakeTimers();
8
10
  });
9
- afterEach(() => {
11
+ afterEach(function () {
10
12
  jest.runOnlyPendingTimers();
11
13
  jest.useRealTimers();
12
14
  });
13
- it("renders without error", () => {
14
- renderWithWrappers(_jsx(Dialog, { title: "title", isVisible: true, primaryCta: {
15
+ it("renders without error", function () {
16
+ (0, renderWithWrappers_1.renderWithWrappers)((0, jsx_runtime_1.jsx)(Dialog_1.Dialog, { title: "title", isVisible: true, primaryCta: {
15
17
  text: "Primary Action Button",
16
18
  onPress: jest.fn(),
17
19
  } }));
18
- expect(screen.getByText("title")).toBeOnTheScreen();
20
+ expect(react_native_1.screen.getByText("title")).toBeOnTheScreen();
19
21
  });
20
- it("should render details if it is passed", () => {
21
- renderWithWrappers(_jsx(Dialog, { title: "title", detail: "Some unique detail", isVisible: true, primaryCta: {
22
+ it("should render details if it is passed", function () {
23
+ (0, renderWithWrappers_1.renderWithWrappers)((0, jsx_runtime_1.jsx)(Dialog_1.Dialog, { title: "title", detail: "Some unique detail", isVisible: true, primaryCta: {
22
24
  text: "Primary Action Button",
23
25
  onPress: jest.fn(),
24
26
  } }));
25
- expect(screen.getByText("Some unique detail")).toBeOnTheScreen();
27
+ expect(react_native_1.screen.getByText("Some unique detail")).toBeOnTheScreen();
26
28
  });
27
- it("should render the primary action button", () => {
28
- const primaryActionMock = jest.fn();
29
- renderWithWrappers(_jsx(Dialog, { title: "title", isVisible: true, primaryCta: {
29
+ it("should render the primary action button", function () {
30
+ var primaryActionMock = jest.fn();
31
+ (0, renderWithWrappers_1.renderWithWrappers)((0, jsx_runtime_1.jsx)(Dialog_1.Dialog, { title: "title", isVisible: true, primaryCta: {
30
32
  text: "Primary Action Button",
31
33
  onPress: primaryActionMock,
32
34
  } }));
33
- const primaryButton = screen.getByTestId("dialog-primary-action-button");
34
- fireEvent.press(primaryButton);
35
- act(() => {
35
+ var primaryButton = react_native_1.screen.getByTestId("dialog-primary-action-button");
36
+ react_native_1.fireEvent.press(primaryButton);
37
+ (0, react_native_1.act)(function () {
36
38
  jest.runAllTimers();
37
39
  });
38
40
  expect(primaryActionMock).toHaveBeenCalled();
39
- expect(screen.getByText("Primary Action Button")).toBeOnTheScreen();
41
+ expect(react_native_1.screen.getByText("Primary Action Button")).toBeOnTheScreen();
40
42
  });
41
- it("should render the secondary action button if it is passed", () => {
42
- const secondaryActionMock = jest.fn();
43
- renderWithWrappers(_jsx(Dialog, { title: "title", isVisible: true, primaryCta: {
43
+ it("should render the secondary action button if it is passed", function () {
44
+ var secondaryActionMock = jest.fn();
45
+ (0, renderWithWrappers_1.renderWithWrappers)((0, jsx_runtime_1.jsx)(Dialog_1.Dialog, { title: "title", isVisible: true, primaryCta: {
44
46
  text: "Primary Action Button",
45
47
  onPress: jest.fn(),
46
48
  }, secondaryCta: {
47
49
  text: "Secondary Action Button",
48
50
  onPress: secondaryActionMock,
49
51
  } }));
50
- const secondaryButton = screen.getByTestId("dialog-secondary-action-button");
51
- fireEvent.press(secondaryButton);
52
+ var secondaryButton = react_native_1.screen.getByTestId("dialog-secondary-action-button");
53
+ react_native_1.fireEvent.press(secondaryButton);
52
54
  jest.runAllTimers();
53
55
  expect(secondaryActionMock).toHaveBeenCalled();
54
- expect(screen.getByText("Secondary Action Button")).toBeOnTheScreen();
56
+ expect(react_native_1.screen.getByText("Secondary Action Button")).toBeOnTheScreen();
55
57
  });
56
- it("should call onBackgroundPress when backdrop is pressed", () => {
57
- const onBackgroundPressMock = jest.fn();
58
- renderWithWrappers(_jsx(Dialog, { title: "title", isVisible: true, onBackgroundPress: onBackgroundPressMock, primaryCta: {
58
+ it("should call onBackgroundPress when backdrop is pressed", function () {
59
+ var onBackgroundPressMock = jest.fn();
60
+ (0, renderWithWrappers_1.renderWithWrappers)((0, jsx_runtime_1.jsx)(Dialog_1.Dialog, { title: "title", isVisible: true, onBackgroundPress: onBackgroundPressMock, primaryCta: {
59
61
  text: "Primary Action Button",
60
62
  onPress: jest.fn(),
61
63
  } }));
62
- fireEvent.press(screen.getByTestId("dialog-backdrop"));
63
- act(() => {
64
+ react_native_1.fireEvent.press(react_native_1.screen.getByTestId("dialog-backdrop"));
65
+ (0, react_native_1.act)(function () {
64
66
  jest.runAllTimers();
65
67
  });
66
68
  expect(onBackgroundPressMock).toHaveBeenCalled();
@@ -1 +1,17 @@
1
- export * from "./Dialog";
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("./Dialog"), exports);