@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,35 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __assign = (this && this.__assign) || function () {
|
|
7
|
+
__assign = Object.assign || function(t) {
|
|
8
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
+
s = arguments[i];
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
return __assign.apply(this, arguments);
|
|
16
|
+
};
|
|
17
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
18
|
+
var t = {};
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
22
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
24
|
+
t[p[i]] = s[p[i]];
|
|
25
|
+
}
|
|
26
|
+
return t;
|
|
27
|
+
};
|
|
28
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
29
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
30
|
+
if (ar || !(i in from)) {
|
|
31
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
32
|
+
ar[i] = from[i];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
|
+
};
|
|
37
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.Text = void 0;
|
|
42
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
43
|
+
var react_1 = require("react");
|
|
44
|
+
var react_native_1 = require("react-native");
|
|
45
|
+
var native_1 = __importDefault(require("styled-components/native"));
|
|
46
|
+
var styled_system_1 = require("styled-system");
|
|
47
|
+
var helpers_1 = require("./helpers");
|
|
48
|
+
var useTheme_1 = require("../../utils/hooks/useTheme");
|
|
49
|
+
exports.Text = (0, react_1.forwardRef)(function (_a, ref) {
|
|
50
|
+
var _b = _a.variant, variant = _b === void 0 ? "sm" : _b, _c = _a.italic, italic = _c === void 0 ? false : _c, _d = _a.color, color = _d === void 0 ? "onBackgroundHigh" : _d, _e = _a.caps, caps = _e === void 0 ? false : _e, _f = _a.weight, weight = _f === void 0 ? "regular" : _f, _g = _a.underline, underline = _g === void 0 ? false : _g, _h = _a.maxWidth, maxWidth = _h === void 0 ? false : _h, _j = _a.selectable, selectable = _j === void 0 ? true : _j, style = _a.style, children = _a.children, restProps = __rest(_a, ["variant", "italic", "color", "caps", "weight", "underline", "maxWidth", "selectable", "style", "children"]);
|
|
51
|
+
var theme = (0, useTheme_1.useTheme)().theme;
|
|
52
|
+
var fontFamily = (0, helpers_1.useFontFamilyFor)({ italic: italic, weight: weight });
|
|
53
|
+
var nativeTextStyle = [caps ? { textTransform: "uppercase" } : {}];
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(InnerStyledText, __assign({ ref: ref, selectable: selectable, style: __spreadArray(__spreadArray([], nativeTextStyle, true), [
|
|
14
55
|
{ textAlignVertical: "center" }, // android renders text higher by default, so we bring it down to be consistent with ios
|
|
15
56
|
{ textDecorationLine: !!underline ? "underline" : "none" },
|
|
16
57
|
{ fontStyle: italic ? "italic" : undefined },
|
|
17
58
|
!!maxWidth ? { width: "100%", maxWidth: 600, alignSelf: "center" } : {},
|
|
18
59
|
// Overriding the font family for the regular font to avoid breaking the layout (mainly on android)
|
|
19
60
|
// See: https://github.com/facebook/react-native/issues/53286
|
|
20
|
-
Platform.OS === "android" ? {} : { fontFamily },
|
|
61
|
+
react_native_1.Platform.OS === "android" ? {} : { fontFamily: fontFamily },
|
|
21
62
|
style, // keep last so we can override
|
|
22
|
-
],
|
|
63
|
+
], false) }, fixTextTreatmentForStyledComponent(theme.textTreatments[variant]), { children: children, color: color }, restProps)));
|
|
23
64
|
});
|
|
24
|
-
|
|
25
|
-
|
|
65
|
+
var fixTextTreatmentForStyledComponent = function (treatment) {
|
|
66
|
+
var treatmentWithUnits = __assign({}, treatment);
|
|
26
67
|
if (treatment.lineHeight !== undefined) {
|
|
27
|
-
treatmentWithUnits.lineHeight =
|
|
68
|
+
treatmentWithUnits.lineHeight = "".concat(treatment.lineHeight, "px");
|
|
28
69
|
}
|
|
29
70
|
return treatmentWithUnits;
|
|
30
71
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
${space}
|
|
34
|
-
${typography}
|
|
35
|
-
`;
|
|
72
|
+
var InnerStyledText = (0, native_1.default)(react_native_1.Text)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n"], ["\n ", "\n ", "\n ", "\n"])), styled_system_1.color, styled_system_1.space, styled_system_1.typography);
|
|
73
|
+
var templateObject_1;
|
|
@@ -1,40 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FontCenteringPalette = exports.FontCenteringRaw = exports.Misc = exports.BasicProps = exports.VariantsInBoxes = exports.Variants = void 0;
|
|
4
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
var react_native_1 = require("react-native");
|
|
6
|
+
var helpers_1 = require("../../storybook/helpers");
|
|
7
|
+
var Box_1 = require("../Box");
|
|
8
|
+
var Flex_1 = require("../Flex");
|
|
9
|
+
var Text_1 = require("../Text");
|
|
10
|
+
var meta = {
|
|
8
11
|
title: "Theme/Text",
|
|
9
|
-
component: Text,
|
|
12
|
+
component: Text_1.Text,
|
|
10
13
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
render: ()
|
|
14
|
+
exports.default = meta;
|
|
15
|
+
var variants = ["xs", "sm", "md", "lg", "xl", "xxl"];
|
|
16
|
+
exports.Variants = {
|
|
17
|
+
render: function () { return ((0, jsx_runtime_1.jsx)(helpers_1.DataList, { data: variants, renderItem: function (_a) {
|
|
18
|
+
var variant = _a.item;
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)(Text_1.Text, { variant: variant, children: [variant, " ~~ This is a text."] }));
|
|
20
|
+
} })); },
|
|
15
21
|
};
|
|
16
|
-
|
|
17
|
-
render: ()
|
|
22
|
+
exports.VariantsInBoxes = {
|
|
23
|
+
render: function () { return ((0, jsx_runtime_1.jsx)(helpers_1.DataList, { data: variants, renderItem: function (_a) {
|
|
24
|
+
var variant = _a.item;
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(Box_1.Box, { borderWidth: 1, borderColor: "black", width: 100, children: (0, jsx_runtime_1.jsxs)(Text_1.Text, { variant: variant, children: [variant, " ~~ This is a text."] }) }));
|
|
26
|
+
} })); },
|
|
18
27
|
};
|
|
19
|
-
|
|
20
|
-
render: ()
|
|
28
|
+
exports.BasicProps = {
|
|
29
|
+
render: function () { return ((0, jsx_runtime_1.jsxs)(helpers_1.List, { children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { children: "regular ~~ This is a text." }), (0, jsx_runtime_1.jsx)(Text_1.LinkText, { children: "LinkText." }), (0, jsx_runtime_1.jsx)(Text_1.Text, { caps: true, children: "caps ~~ This is a text." }), (0, jsx_runtime_1.jsx)(Text_1.Text, { italic: true, children: "italics ~~ This is a text." }), (0, jsx_runtime_1.jsx)(Text_1.Text, { caps: true, italic: true, children: "caps italics ~~ This is a text." }), (0, jsx_runtime_1.jsx)(Text_1.Text, { weight: "medium", children: "weight: medium ~~ This is a text." }), (0, jsx_runtime_1.jsx)(Text_1.Text, { maxWidth: true, children: "maxwidth ~~ This is a text." })] })); },
|
|
21
30
|
};
|
|
22
|
-
|
|
23
|
-
render: ()
|
|
31
|
+
exports.Misc = {
|
|
32
|
+
render: function () { return ((0, jsx_runtime_1.jsxs)(helpers_1.List, { children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: { borderWidth: 1, borderColor: "black" }, children: (0, jsx_runtime_1.jsx)(Text_1.Text, { pl: 2, mb: 4, mr: 80, color: "red", backgroundColor: "orange", children: "Testing the other props" }) }), (0, jsx_runtime_1.jsx)(react_native_1.View, {}), (0, jsx_runtime_1.jsx)(Text_1.Text, { lineHeight: "20px", fontSize: 30, children: "wow" })] })); },
|
|
24
33
|
};
|
|
25
34
|
// this is useful for making sure our custom fonts are rendering at the same height for ios and android
|
|
26
|
-
|
|
27
|
-
render: ()
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return (
|
|
35
|
+
exports.FontCenteringRaw = {
|
|
36
|
+
render: function () {
|
|
37
|
+
var style = { borderWidth: 1, borderColor: "black", fontSize: 16, lineHeight: 16 };
|
|
38
|
+
var systemFontStyle = react_native_1.Platform.OS === "android" ? { textAlignVertical: "bottom" } : {}; // this we add in our Text in palette-eigen
|
|
39
|
+
var unicaFontStyle = react_native_1.Platform.OS === "android" ? { textAlignVertical: "center" } : {}; // this we add in our Text in palette-eigen
|
|
40
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", flex: 1, children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flex: 1, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { children: "System font" }), (0, jsx_runtime_1.jsxs)(helpers_1.List, { children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [style, systemFontStyle], children: "regular TEXT." }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [style, systemFontStyle], children: "ALL CAPS text." })] })] }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { width: "1px", height: "100%", borderWidth: 1, borderColor: "black" }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flex: 1, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { children: "Unica custom font" }), (0, jsx_runtime_1.jsxs)(helpers_1.List, { children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [style, { fontFamily: "Unica77LL-Regular" }, unicaFontStyle], children: "regular TEXT." }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [style, { fontFamily: "Unica77LL-Regular" }, unicaFontStyle], children: "ALL CAPS text." })] })] })] }));
|
|
32
41
|
},
|
|
33
42
|
};
|
|
34
43
|
// this is useful for making sure our custom fonts are rendering at the same height for ios and android
|
|
35
|
-
|
|
36
|
-
render: ()
|
|
37
|
-
|
|
38
|
-
return (
|
|
44
|
+
exports.FontCenteringPalette = {
|
|
45
|
+
render: function () {
|
|
46
|
+
var style = { borderWidth: 1, borderColor: "black", fontSize: 16, lineHeight: 16 };
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flex: 1, children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { children: "System font" }), (0, jsx_runtime_1.jsxs)(helpers_1.List, { children: [(0, jsx_runtime_1.jsx)(Text_1.Text, { style: style, children: "regular TEXT." }), (0, jsx_runtime_1.jsx)(Text_1.Text, { style: style, children: "ALL CAPS text." })] })] }));
|
|
39
48
|
},
|
|
40
49
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var text_1 = require("../../utils/text");
|
|
4
|
+
describe("Text", function () {
|
|
5
|
+
it("uses endash in ranges", function () {
|
|
6
|
+
var usingHelper = (0, text_1.range)("10", "20");
|
|
7
|
+
var usingEndash = "10 ".concat(text_1.endash, " 20");
|
|
6
8
|
expect(usingHelper).toEqual(usingEndash);
|
|
7
9
|
expect(usingHelper).toEqual("10 – 20"); // endash
|
|
8
10
|
expect(usingHelper).not.toEqual("10 - 20"); // minus
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTextStyleForPalette = exports.useFontFamilyFor = void 0;
|
|
4
|
+
var useTheme_1 = require("../../utils/hooks/useTheme");
|
|
5
|
+
var useFontFamilyFor = function (_a) {
|
|
6
|
+
var italic = _a.italic, weight = _a.weight;
|
|
7
|
+
var theme = (0, useTheme_1.useTheme)().theme;
|
|
8
|
+
var fonts = theme.fonts;
|
|
5
9
|
if (italic && weight === "medium") {
|
|
6
10
|
return fonts.sans.mediumItalic;
|
|
7
11
|
}
|
|
@@ -13,17 +17,19 @@ export const useFontFamilyFor = ({ italic, weight, }) => {
|
|
|
13
17
|
}
|
|
14
18
|
return fonts.sans.regular;
|
|
15
19
|
};
|
|
20
|
+
exports.useFontFamilyFor = useFontFamilyFor;
|
|
16
21
|
/**
|
|
17
22
|
* Use this function within Palette and other "atom" components like `Button`, `Pill`, etc.
|
|
18
23
|
* This function returns a `TextStyle` that has a `fontSize` and `lineHeight` of the same number.
|
|
19
24
|
* This is to make a `Text` behave correctly when it needs to be combined with others to make a UI component.
|
|
20
25
|
* Don't use this function when some actual text needs to be displayed. Only use it when text needs to be part of a UI component.
|
|
21
26
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
var useTextStyleForPalette = function (variant) {
|
|
28
|
+
var theme = (0, useTheme_1.useTheme)().theme;
|
|
29
|
+
var fontSizeAndLineHeight = theme.textTreatments[variant].fontSize;
|
|
25
30
|
return {
|
|
26
31
|
fontSize: fontSizeAndLineHeight,
|
|
27
32
|
lineHeight: fontSizeAndLineHeight,
|
|
28
33
|
};
|
|
29
34
|
};
|
|
35
|
+
exports.useTextStyleForPalette = useTextStyleForPalette;
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./helpers"), exports);
|
|
18
|
+
__exportStar(require("./Text"), exports);
|
|
19
|
+
__exportStar(require("./LinkText"), exports);
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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.useToolTipContext = exports.ToolTip = exports.ToolTipContext = void 0;
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var native_1 = require("@artsy/icons/native");
|
|
17
|
+
var lodash_1 = require("lodash");
|
|
18
|
+
var react_1 = require("react");
|
|
19
|
+
var react_native_1 = require("react-native");
|
|
20
|
+
var ToolTipFlyout_1 = require("./ToolTipFlyout");
|
|
21
|
+
var useScreenDimensions_1 = require("../../utils/hooks/useScreenDimensions");
|
|
22
|
+
var useTheme_1 = require("../../utils/hooks/useTheme");
|
|
23
|
+
exports.ToolTipContext = (0, react_1.createContext)({
|
|
24
|
+
dismissToolTip: function () { return lodash_1.noop; },
|
|
25
|
+
setToolTip: function () { return lodash_1.noop; },
|
|
12
26
|
});
|
|
13
27
|
/**
|
|
14
28
|
* A ToolTip Component
|
|
@@ -30,80 +44,80 @@ export const ToolTipContext = createContext({
|
|
|
30
44
|
* </ToolTip>
|
|
31
45
|
*
|
|
32
46
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
var ToolTip = function (_a) {
|
|
48
|
+
var _b;
|
|
49
|
+
var children = _a.children, _c = _a.enabled, enabled = _c === void 0 ? true : _c, flowDirection = _a.flowDirection, initialToolTipText = _a.initialToolTipText, maxWidth = _a.maxWidth, onPress = _a.onPress, _d = _a.position, position = _d === void 0 ? "TOP" : _d, _e = _a.tapToDismiss, tapToDismiss = _e === void 0 ? false : _e, testID = _a.testID, _f = _a.xOffset, xOffset = _f === void 0 ? 0 : _f, _g = _a.yOffset, yOffset = _g === void 0 ? 5 : _g;
|
|
50
|
+
var space = (0, useTheme_1.useTheme)().space;
|
|
51
|
+
var mWidth = (0, useScreenDimensions_1.useScreenDimensions)().width - space(2) * 2; // 40 accounting for padding 20 on each side of the screen
|
|
52
|
+
var MAX_TOOLTIP_WIDTH = maxWidth !== null && maxWidth !== void 0 ? maxWidth : mWidth;
|
|
53
|
+
var _h = (0, react_1.useState)(initialToolTipText), toolTipText = _h[0], setToolTip = _h[1];
|
|
54
|
+
var _j = (0, react_1.useState)({ height: 0, width: 0, x: 0 }), childrenDimensions = _j[0], setChildrenDimensions = _j[1];
|
|
55
|
+
var _k = (0, react_1.useState)({ height: 0, width: 0 }), singleTextDimension = _k[0], setSingleTextDimension = _k[1];
|
|
56
|
+
var dismissToolTip = function () { return setToolTip(undefined); };
|
|
57
|
+
var _l = (0, react_1.useState)(0), pageX = _l[0], setPageX = _l[1];
|
|
58
|
+
var childrenRef = (0, react_1.useRef)(null);
|
|
59
|
+
var sampleTextRef = (0, react_1.useRef)(null);
|
|
60
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
61
|
+
var _a;
|
|
62
|
+
(_a = childrenRef.current) === null || _a === void 0 ? void 0 : _a.measureInWindow(function (x, _y, width, height) {
|
|
63
|
+
setChildrenDimensions({ height: height, width: width, x: x });
|
|
47
64
|
setPageX(x);
|
|
48
65
|
});
|
|
49
66
|
}, []);
|
|
50
|
-
useLayoutEffect(()
|
|
67
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
68
|
+
var _a;
|
|
51
69
|
if (enabled && toolTipText) {
|
|
52
|
-
sampleTextRef.current
|
|
70
|
+
(_a = sampleTextRef.current) === null || _a === void 0 ? void 0 : _a.measureInWindow(function (_x, _y, width, height) {
|
|
53
71
|
if (width > 0 && height > 0) {
|
|
54
|
-
setSingleTextDimension({ height, width });
|
|
72
|
+
setSingleTextDimension({ height: height, width: width });
|
|
55
73
|
}
|
|
56
74
|
});
|
|
57
75
|
}
|
|
58
76
|
}, [enabled, toolTipText]);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
var totalTextWidth = singleTextDimension.width * ((_b = toolTipText === null || toolTipText === void 0 ? void 0 : toolTipText.length) !== null && _b !== void 0 ? _b : 0);
|
|
78
|
+
var finalToolTipWidth = Math.min(totalTextWidth, MAX_TOOLTIP_WIDTH);
|
|
79
|
+
var numOfLines = getNumberOfLines(finalToolTipWidth, totalTextWidth);
|
|
80
|
+
var finalToolTipHeight = numOfLines * singleTextDimension.height;
|
|
81
|
+
var triangleXDisplacement = childrenDimensions.x + childrenDimensions.width / 2;
|
|
64
82
|
// Calculate the direction of flow of the tooltip. So a tooltip near the right edge of the screen
|
|
65
83
|
// should flow to the left so it remains in the viewport, and vice-versa. Without this, tooltip
|
|
66
84
|
// around the edges can flow off screen
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
dismissToolTip,
|
|
72
|
-
setToolTip,
|
|
73
|
-
}, children: [!!enabled && position === "TOP" && (
|
|
74
|
-
bottom: childrenDimensions.height + yOffset,
|
|
75
|
-
left: xOffset,
|
|
76
|
-
...extraStyle,
|
|
77
|
-
}, tapToDismiss: tapToDismiss, height: finalToolTipHeight, width: finalToolTipWidth, onClose: dismissToolTip, onToolTipPress: onPress, position: position, testID: testID, text: toolTipText }), !!enabled && position === "TOP" && !!toolTipText && (_jsx(TriangleDownIcon, { style: {
|
|
85
|
+
var nearLeftEdge = pageX < mWidth / 4 || flowDirection === "RIGHT";
|
|
86
|
+
var nearRightEdge = pageX > mWidth - mWidth / 4 || flowDirection === "LEFT";
|
|
87
|
+
var extraStyle = nearLeftEdge ? { left: 0 } : nearRightEdge ? { right: 0 } : undefined;
|
|
88
|
+
return ((0, jsx_runtime_1.jsxs)(exports.ToolTipContext.Provider, { value: {
|
|
89
|
+
dismissToolTip: dismissToolTip,
|
|
90
|
+
setToolTip: setToolTip,
|
|
91
|
+
}, children: [!!enabled && position === "TOP" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ToolTipFlyout_1.ToolTipFlyout, { containerStyle: __assign({ bottom: childrenDimensions.height + yOffset, left: xOffset }, extraStyle), tapToDismiss: tapToDismiss, height: finalToolTipHeight, width: finalToolTipWidth, onClose: dismissToolTip, onToolTipPress: onPress, position: position, testID: testID, text: toolTipText }), !!enabled && position === "TOP" && !!toolTipText && ((0, jsx_runtime_1.jsx)(native_1.TriangleDownIcon, { style: {
|
|
78
92
|
left: triangleXDisplacement + xOffset,
|
|
79
93
|
position: "absolute",
|
|
80
94
|
bottom: childrenDimensions.height + yOffset - 5, // where 5 is the triangle icon size
|
|
81
|
-
} }))] })),
|
|
82
|
-
top: childrenDimensions.height + yOffset,
|
|
83
|
-
...extraStyle,
|
|
84
|
-
}, tapToDismiss: tapToDismiss, height: finalToolTipHeight, width: finalToolTipWidth, onClose: dismissToolTip, onToolTipPress: onPress, position: position, testID: testID, text: toolTipText }), !!enabled && position === "BOTTOM" && !!toolTipText && (_jsx(TriangleDownIcon, { style: {
|
|
95
|
+
} }))] })), (0, jsx_runtime_1.jsx)(react_native_1.View, { ref: childrenRef, children: children }), !!enabled && position === "BOTTOM" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ToolTipFlyout_1.ToolTipFlyout, { containerStyle: __assign({ top: childrenDimensions.height + yOffset }, extraStyle), tapToDismiss: tapToDismiss, height: finalToolTipHeight, width: finalToolTipWidth, onClose: dismissToolTip, onToolTipPress: onPress, position: position, testID: testID, text: toolTipText }), !!enabled && position === "BOTTOM" && !!toolTipText && ((0, jsx_runtime_1.jsx)(native_1.TriangleDownIcon, { style: {
|
|
85
96
|
transform: [{ rotate: "180deg" }],
|
|
86
97
|
left: triangleXDisplacement + xOffset,
|
|
87
98
|
position: "absolute",
|
|
88
99
|
top: childrenDimensions.height + yOffset - 5, // where 5 is the triangle icon size,
|
|
89
|
-
} }))] })), !!enabled && !!toolTipText && (
|
|
100
|
+
} }))] })), !!enabled && !!toolTipText && ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: sampleTextRef, style: { position: "absolute", opacity: 0 }, children: (0, jsx_runtime_1.jsx)(ToolTipFlyout_1.ToolTipTextContainer, { text: "x" }) }))] }));
|
|
90
101
|
};
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
exports.ToolTip = ToolTip;
|
|
103
|
+
var useToolTipContext = function () {
|
|
104
|
+
var context = (0, react_1.useContext)(exports.ToolTipContext);
|
|
93
105
|
if (!context) {
|
|
94
106
|
throw new Error("Attempted to use useToolTipContext outside of ToolTip Provider. Please wrap your component with <ToolTip>");
|
|
95
107
|
}
|
|
96
108
|
return context;
|
|
97
109
|
};
|
|
110
|
+
exports.useToolTipContext = useToolTipContext;
|
|
98
111
|
/** Given a maximum width and a total width, how many of the maximum widths can we get from the total width?
|
|
99
112
|
* The answer gotten will let us know how many lines of text the tool tip text will need.
|
|
100
113
|
* Note: We add one for whatever spill over remains i.e text that does not fill an entire line.
|
|
101
114
|
*/
|
|
102
|
-
|
|
115
|
+
var getNumberOfLines = function (maxWidth, totalWidth, numLines) {
|
|
116
|
+
if (numLines === void 0) { numLines = 0; }
|
|
103
117
|
if (maxWidth >= totalWidth) {
|
|
104
118
|
return numLines + 1;
|
|
105
119
|
}
|
|
106
|
-
|
|
120
|
+
var remainder = totalWidth - maxWidth;
|
|
107
121
|
if (remainder > -1) {
|
|
108
122
|
numLines = numLines += 1;
|
|
109
123
|
}
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChangeToolTip = exports.BottomToolTip = exports.SimpleToolTip = void 0;
|
|
4
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
var ToolTip_1 = require("./ToolTip");
|
|
6
|
+
var Button_1 = require("../Button");
|
|
7
|
+
var Flex_1 = require("../Flex");
|
|
8
|
+
var Text_1 = require("../Text");
|
|
9
|
+
exports.default = {
|
|
7
10
|
title: "ToolTip",
|
|
8
11
|
};
|
|
9
|
-
|
|
10
|
-
SimpleToolTip
|
|
12
|
+
var SimpleToolTip = function () { return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignSelf: "center", mt: "200px", alignItems: "center", flexWrap: "wrap", children: (0, jsx_runtime_1.jsx)(ToolTip_1.ToolTip, { initialToolTipText: "Tap to dismiss me", position: "TOP", tapToDismiss: true, children: (0, jsx_runtime_1.jsx)(Text_1.Text, { weight: "medium", children: "I am a Text" }) }) })); };
|
|
13
|
+
exports.SimpleToolTip = SimpleToolTip;
|
|
14
|
+
exports.SimpleToolTip.story = {
|
|
11
15
|
name: "Simple ToolTip",
|
|
12
16
|
};
|
|
13
|
-
|
|
14
|
-
BottomToolTip
|
|
17
|
+
var BottomToolTip = function () { return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignSelf: "center", mt: "200px", flexWrap: "wrap", children: (0, jsx_runtime_1.jsx)(ToolTip_1.ToolTip, { initialToolTipText: "Bottom tooltip", position: "BOTTOM", tapToDismiss: true, children: (0, jsx_runtime_1.jsx)(Text_1.Text, { weight: "medium", children: "I am a Text" }) }) })); };
|
|
18
|
+
exports.BottomToolTip = BottomToolTip;
|
|
19
|
+
exports.BottomToolTip.story = {
|
|
15
20
|
name: "Bottom ToolTip",
|
|
16
21
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
var ChangeToolTip = function () { return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignSelf: "center", mt: "200px", children: (0, jsx_runtime_1.jsx)(ToolTip_1.ToolTip, { initialToolTipText: "I can be changed", position: "TOP", tapToDismiss: true, children: (0, jsx_runtime_1.jsx)(ToolTip_1.ToolTipContext.Consumer, { children: function (_a) {
|
|
23
|
+
var setToolTip = _a.setToolTip;
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(Button_1.Button, { size: "small", onPress: function () { return setToolTip("I'm the new tooltip"); }, children: "Press To Change ToolTip" }));
|
|
25
|
+
} }) }) })); };
|
|
26
|
+
exports.ChangeToolTip = ChangeToolTip;
|
|
27
|
+
exports.ChangeToolTip.story = {
|
|
21
28
|
name: "Change ToolTip",
|
|
22
29
|
};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 ToolTip_1 = require("./ToolTip");
|
|
6
|
+
var hooks_1 = require("../../utils/hooks");
|
|
7
|
+
var renderWithWrappers_1 = require("../../utils/tests/renderWithWrappers");
|
|
8
|
+
var Text_1 = require("../Text");
|
|
9
|
+
describe("ToolTip", function () {
|
|
10
|
+
it("shows the flyout when enabled", function () {
|
|
11
|
+
(0, renderWithWrappers_1.renderWithWrappers)((0, jsx_runtime_1.jsx)(hooks_1.ScreenDimensionsProvider, { children: (0, jsx_runtime_1.jsx)(ToolTip_1.ToolTip, { enabled: true, testID: "flyout", initialToolTipText: "Words", children: (0, jsx_runtime_1.jsx)(Text_1.Text, { children: "Text" }) }) }));
|
|
12
|
+
expect(react_native_1.screen.getByTestId("flyout")).toBeOnTheScreen();
|
|
11
13
|
});
|
|
12
|
-
it("Does not show the flyout when disabled", ()
|
|
13
|
-
renderWithWrappers(
|
|
14
|
-
expect(screen.queryByTestId("flyout")).not.toBeOnTheScreen();
|
|
14
|
+
it("Does not show the flyout when disabled", function () {
|
|
15
|
+
(0, renderWithWrappers_1.renderWithWrappers)((0, jsx_runtime_1.jsx)(hooks_1.ScreenDimensionsProvider, { children: (0, jsx_runtime_1.jsx)(ToolTip_1.ToolTip, { enabled: false, testID: "flyout", initialToolTipText: "Words", children: (0, jsx_runtime_1.jsx)(Text_1.Text, { children: "Text" }) }) }));
|
|
16
|
+
expect(react_native_1.screen.queryByTestId("flyout")).not.toBeOnTheScreen();
|
|
15
17
|
});
|
|
16
18
|
});
|