@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.
- package/dist/Theme.js +16 -11
- package/dist/animation/CssTransition.js +71 -26
- package/dist/animation/index.js +17 -1
- package/dist/constants.js +12 -8
- package/dist/elements/ArtsyKeyboardAvoidingView/ArtsyKeyboardAvoidingView.js +116 -69
- package/dist/elements/ArtsyKeyboardAvoidingView/index.js +17 -1
- package/dist/elements/Autocomplete/Autocomplete.js +32 -23
- package/dist/elements/Autocomplete/Autocomplete.tests.js +128 -56
- package/dist/elements/Autocomplete/index.js +17 -1
- package/dist/elements/Avatar/Avatar.js +20 -15
- package/dist/elements/Avatar/Avatar.stories.js +29 -15
- package/dist/elements/Avatar/Avatar.tests.js +12 -10
- package/dist/elements/Avatar/index.js +17 -1
- package/dist/elements/BackButton/BackButton.js +16 -9
- package/dist/elements/BackButton/BackButton.stories.js +12 -8
- package/dist/elements/BackButton/index.js +17 -1
- package/dist/elements/Banner/Banner.js +45 -18
- package/dist/elements/Banner/Banner.stories.js +12 -8
- package/dist/elements/Banner/index.js +17 -1
- package/dist/elements/BorderBox/BorderBox.js +16 -11
- package/dist/elements/BorderBox/index.js +17 -1
- package/dist/elements/Box/Box.js +16 -14
- package/dist/elements/Box/Box.stories.js +21 -15
- package/dist/elements/Box/index.js +17 -1
- package/dist/elements/Button/Button.js +85 -64
- package/dist/elements/Button/Button.stories.js +48 -23
- package/dist/elements/Button/CTAButton.js +18 -3
- package/dist/elements/Button/FollowButton.js +38 -11
- package/dist/elements/Button/LinkButton.js +19 -4
- package/dist/elements/Button/colors.js +7 -3
- package/dist/elements/Button/index.js +20 -4
- package/dist/elements/ButtonNew/Button.js +114 -49
- package/dist/elements/ButtonNew/Button.stories.js +64 -38
- package/dist/elements/ButtonNew/Button.tests.js +23 -21
- package/dist/elements/ButtonNew/CTAButton.js +18 -3
- package/dist/elements/ButtonNew/FollowButton.js +36 -9
- package/dist/elements/ButtonNew/LinkButton.js +19 -4
- package/dist/elements/ButtonNew/colors.js +7 -3
- package/dist/elements/ButtonNew/index.js +20 -4
- package/dist/elements/Checkbox/Check.js +83 -46
- package/dist/elements/Checkbox/Checkbox.js +83 -47
- package/dist/elements/Checkbox/Checkbox.stories.js +10 -9
- package/dist/elements/Checkbox/index.js +18 -2
- package/dist/elements/Chip/Chip.js +23 -18
- package/dist/elements/Chip/Chip.stories.js +12 -8
- package/dist/elements/Chip/index.js +17 -1
- package/dist/elements/ClassTheme/ClassTheme.js +10 -5
- package/dist/elements/ClassTheme/index.js +17 -1
- package/dist/elements/Collapse/Collapse.js +9 -4
- package/dist/elements/Collapse/Collapse.stories.js +13 -9
- package/dist/elements/Collapse/index.js +17 -1
- package/dist/elements/CollapsibleMenuItem/CollapsibleMenuItem.js +32 -27
- package/dist/elements/CollapsibleMenuItem/CollapsibleMenuItem.stories.js +62 -37
- package/dist/elements/CollapsibleMenuItem/index.js +17 -1
- package/dist/elements/Dialog/Dialog.js +52 -26
- package/dist/elements/Dialog/Dialog.stories.js +41 -22
- package/dist/elements/Dialog/Dialog.tests.js +33 -31
- package/dist/elements/Dialog/index.js +17 -1
- package/dist/elements/EntityHeader/EntityHeader.js +42 -15
- package/dist/elements/EntityHeader/EntityHeader.stories.js +26 -18
- package/dist/elements/EntityHeader/index.js +17 -1
- package/dist/elements/Flex/Flex.js +32 -4
- package/dist/elements/Flex/index.js +17 -1
- package/dist/elements/Header/ArtsyLogoHeader.js +15 -8
- package/dist/elements/Header/index.js +17 -1
- package/dist/elements/Histogram/Histogram.js +19 -14
- package/dist/elements/Histogram/index.js +17 -1
- package/dist/elements/Image/Image.js +60 -28
- package/dist/elements/Image/Image.stories.js +35 -23
- package/dist/elements/Image/__tests__/getImageURL.tests.js +10 -8
- package/dist/elements/Image/helpers/getImageURL.js +13 -8
- package/dist/elements/Image/index.js +17 -1
- package/dist/elements/Input/Input.js +216 -168
- package/dist/elements/Input/Input.stories.js +15 -11
- package/dist/elements/Input/Input.tests.js +85 -39
- package/dist/elements/Input/InputTitle.js +9 -4
- package/dist/elements/Input/helpers.js +35 -27
- package/dist/elements/Input/index.js +19 -3
- package/dist/elements/Input/maskValue.js +25 -9
- package/dist/elements/Input/maskValue.tests.js +19 -17
- package/dist/elements/Join/Join.js +14 -9
- package/dist/elements/Join/index.js +17 -1
- package/dist/elements/LazyFlatlist/LazyFlatlist.js +11 -8
- package/dist/elements/LazyFlatlist/index.js +18 -2
- package/dist/elements/LazyFlatlist/useHasSeenItem.js +19 -12
- package/dist/elements/LegacyScreen/LegacyScreen.js +124 -83
- package/dist/elements/LegacyScreen/index.js +17 -1
- package/dist/elements/LegacyTabs/ContentTabs.js +18 -12
- package/dist/elements/LegacyTabs/NavigationalTabs.js +21 -15
- package/dist/elements/LegacyTabs/StepTabs.js +25 -19
- package/dist/elements/LegacyTabs/Tab.js +31 -19
- package/dist/elements/LegacyTabs/TabBarContainer.js +48 -39
- package/dist/elements/LegacyTabs/index.js +38 -9
- package/dist/elements/List/BulletedItem.js +34 -7
- package/dist/elements/List/List.stories.js +12 -8
- package/dist/elements/List/index.js +17 -1
- package/dist/elements/MeasuredView/MeasuredView.js +18 -12
- package/dist/elements/MeasuredView/index.js +17 -1
- package/dist/elements/MenuItem/MenuItem.js +14 -9
- package/dist/elements/MenuItem/MenuItem.stories.js +9 -5
- package/dist/elements/MenuItem/index.js +17 -1
- package/dist/elements/Message/Message.js +35 -19
- package/dist/elements/Message/Message.stories.d.ts +1 -1
- package/dist/elements/Message/Message.stories.js +23 -17
- package/dist/elements/Message/Message.tests.js +38 -36
- package/dist/elements/Message/index.js +17 -1
- package/dist/elements/Pill/Pill.js +116 -138
- package/dist/elements/Pill/Pill.stories.js +28 -20
- package/dist/elements/Pill/Pill.tests.js +15 -13
- package/dist/elements/Pill/index.js +17 -1
- package/dist/elements/PopIn/PopIn.js +13 -8
- package/dist/elements/PopIn/index.js +17 -1
- package/dist/elements/Popover/Popover.js +45 -15
- package/dist/elements/Popover/Popover.stories.js +25 -19
- package/dist/elements/Popover/index.js +17 -1
- package/dist/elements/ProgressBar/ProgressBar.js +68 -23
- package/dist/elements/ProgressBar/ProgressBar.stories.js +11 -7
- package/dist/elements/ProgressBar/ProgressBar.tests.js +48 -23
- package/dist/elements/ProgressBar/index.js +17 -1
- package/dist/elements/Radio/RadioButton.js +80 -44
- package/dist/elements/Radio/RadioButton.stories.js +17 -13
- package/dist/elements/Radio/RadioDot.js +31 -15
- package/dist/elements/Radio/index.js +7 -2
- package/dist/elements/Screen/Background.js +10 -3
- package/dist/elements/Screen/Body.js +37 -10
- package/dist/elements/Screen/BottomView.js +17 -9
- package/dist/elements/Screen/FloatingHeader.js +36 -9
- package/dist/elements/Screen/FullWidthDivider.js +20 -5
- package/dist/elements/Screen/FullWidthItem.js +20 -5
- package/dist/elements/Screen/Header.js +79 -26
- package/dist/elements/Screen/Screen.stories.js +46 -30
- package/dist/elements/Screen/ScreenBase.js +39 -11
- package/dist/elements/Screen/ScreenFlatList.js +26 -9
- package/dist/elements/Screen/ScreenScrollContext.js +21 -15
- package/dist/elements/Screen/ScreenScrollView.js +27 -9
- package/dist/elements/Screen/StickySubHeader.js +62 -23
- package/dist/elements/Screen/constants.js +8 -5
- package/dist/elements/Screen/hooks/useListenForScreenScroll.js +13 -9
- package/dist/elements/Screen/hooks/useShowLargeTitle.js +19 -14
- package/dist/elements/Screen/hooks/useTitleStyles.js +14 -10
- package/dist/elements/Screen/index.js +48 -31
- package/dist/elements/SearchInput/RoundSearchInput.js +79 -46
- package/dist/elements/SearchInput/SearchInput.js +43 -14
- package/dist/elements/SearchInput/index.js +18 -2
- package/dist/elements/Separator/Separator.js +20 -12
- package/dist/elements/Separator/Separator.stories.js +10 -6
- package/dist/elements/Separator/ShadowSeparator.js +14 -7
- package/dist/elements/Separator/index.js +18 -2
- package/dist/elements/SimpleMessage/SimpleMessage.js +47 -11
- package/dist/elements/SimpleMessage/index.js +17 -1
- package/dist/elements/Skeleton/Skeleton.js +50 -19
- package/dist/elements/Skeleton/Skeleton.stories.js +14 -10
- package/dist/elements/Skeleton/index.js +17 -1
- package/dist/elements/Spacer/Spacer.js +32 -3
- package/dist/elements/Spacer/Spacer.stories.js +35 -19
- package/dist/elements/Spacer/index.js +17 -1
- package/dist/elements/Spinner/Spinner.js +62 -33
- package/dist/elements/Spinner/index.js +17 -1
- package/dist/elements/Switch/Switch.js +50 -17
- package/dist/elements/Switch/Switch.stories.js +31 -14
- package/dist/elements/Switch/index.js +17 -1
- package/dist/elements/Tabs/SubTabBar.js +29 -20
- package/dist/elements/Tabs/TabFlashList.js +24 -12
- package/dist/elements/Tabs/TabFlatList.js +24 -12
- package/dist/elements/Tabs/TabMasonry.js +24 -12
- package/dist/elements/Tabs/TabScrollView.js +27 -14
- package/dist/elements/Tabs/Tabs.js +27 -24
- package/dist/elements/Tabs/Tabs.stories.js +93 -46
- package/dist/elements/Tabs/TabsContainer.js +62 -38
- package/dist/elements/Tabs/TabsWithHeader.js +41 -13
- package/dist/elements/Tabs/hooks/useListenForTabContentScroll.js +13 -9
- package/dist/elements/Tabs/index.js +17 -1
- package/dist/elements/Text/LinkText.js +32 -3
- package/dist/elements/Text/Text.js +61 -23
- package/dist/elements/Text/Text.stories.js +37 -28
- package/dist/elements/Text/Text.tests.js +7 -5
- package/dist/elements/Text/helpers.js +13 -7
- package/dist/elements/Text/index.js +19 -3
- package/dist/elements/ToolTip/ToolTip.js +67 -53
- package/dist/elements/ToolTip/ToolTip.stories.js +21 -14
- package/dist/elements/ToolTip/ToolTip.tests.js +15 -13
- package/dist/elements/ToolTip/ToolTipFlyout.js +68 -28
- package/dist/elements/ToolTip/index.js +17 -1
- package/dist/elements/Touchable/Touchable.js +41 -13
- package/dist/elements/Touchable/Touchable.stories.js +13 -9
- package/dist/elements/Touchable/TouchableHighlightColor.js +38 -12
- package/dist/elements/Touchable/TouchableWithScale.js +38 -11
- package/dist/elements/Touchable/index.js +19 -3
- package/dist/elements/VisualClue/VisualClue.stories.js +11 -7
- package/dist/elements/VisualClue/VisualClueDot.js +24 -14
- package/dist/elements/VisualClue/VisualClueText.js +26 -15
- package/dist/elements/VisualClue/index.js +18 -2
- package/dist/elements/index.js +62 -46
- package/dist/index.js +24 -8
- package/dist/setupJest.js +11 -6
- package/dist/storybook/decorators.js +36 -27
- package/dist/storybook/helpers.js +40 -22
- package/dist/tokens.js +28 -67
- package/dist/types.js +10 -5
- package/dist/utils/Wrap.js +16 -8
- package/dist/utils/colors.stories.js +31 -25
- package/dist/utils/createGeminiUrl.js +28 -22
- package/dist/utils/flattenChildren.js +20 -7
- package/dist/utils/formatLargeNumber.js +8 -4
- package/dist/utils/formatLargeNumbers.tests.js +15 -13
- package/dist/utils/hooks/index.js +20 -4
- package/dist/utils/hooks/useColor.js +6 -2
- package/dist/utils/hooks/useMeasure.js +40 -14
- package/dist/utils/hooks/useScreenDimensions.js +31 -20
- package/dist/utils/hooks/useSpace.js +6 -2
- package/dist/utils/hooks/useTheme.js +31 -23
- package/dist/utils/normalizeText.js +11 -6
- package/dist/utils/space.stories.js +15 -10
- package/dist/utils/tests/flattenChildren.tests.js +8 -6
- package/dist/utils/tests/isTestEnvironment.js +5 -1
- package/dist/utils/tests/renderWithWrappers.js +15 -7
- package/dist/utils/text.js +13 -9
- package/dist/utils/types.js +2 -0
- package/dist/utils/webTokensToMobile.js +16 -10
- package/package.json +30 -36
|
@@ -1,43 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
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 (
|
|
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
|
|
42
|
-
}, disabled: disabled, children: [!!overtitle && (
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
18
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
25
|
-
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
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 (
|
|
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: [
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 (
|
|
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:
|
|
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: [
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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: ()
|
|
11
|
-
},
|
|
24
|
+
onPress: function () { return setVisible(false); },
|
|
25
|
+
} }, props))] }));
|
|
12
26
|
};
|
|
13
|
-
|
|
27
|
+
exports.default = {
|
|
14
28
|
title: "Dialog",
|
|
15
29
|
};
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
34
|
+
onPress: function () { },
|
|
35
|
+
} })); };
|
|
36
|
+
exports.WithSecondaryAction = WithSecondaryAction;
|
|
37
|
+
exports.WithSecondaryAction.story = {
|
|
22
38
|
name: "With secondary action",
|
|
23
39
|
};
|
|
24
|
-
|
|
25
|
-
WithDetails
|
|
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
|
-
|
|
29
|
-
WithLongDetails
|
|
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
|
-
|
|
33
|
-
WithBackgroundPressHandler
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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(
|
|
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(
|
|
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
|
-
|
|
29
|
-
renderWithWrappers(
|
|
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
|
-
|
|
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
|
-
|
|
43
|
-
renderWithWrappers(
|
|
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
|
-
|
|
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
|
-
|
|
58
|
-
renderWithWrappers(
|
|
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
|
-
|
|
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);
|