@ovotech/element-native 3.8.0 → 3.8.1-canary-dff71b6-233
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/components/Accordion/Accordion.js +4 -9
- package/dist/components/Accordion/styles.d.ts +1225 -484
- package/dist/components/Accordion/styles.js +4 -3
- package/dist/components/ActionCard/ActionCard.js +4 -3
- package/dist/components/ActionList/ActionList.d.ts +1 -1
- package/dist/components/ActionList/ActionList.js +2 -1
- package/dist/components/ActionList/styled.d.ts +2502 -1020
- package/dist/components/ActionList/styled.js +6 -5
- package/dist/components/Badge/Badge.d.ts +408 -161
- package/dist/components/Badge/Badge.js +3 -2
- package/dist/components/CTAButton/CTAButton.js +7 -6
- package/dist/components/Card/Card.d.ts +410 -161
- package/dist/components/Card/Card.js +5 -4
- package/dist/components/Checkbox/Checkbox.js +4 -3
- package/dist/components/DataTable/styles.d.ts +5472 -2261
- package/dist/components/DataTable/styles.js +14 -15
- package/dist/components/DateField/DateField.js +4 -3
- package/dist/components/DescriptionList/styled.d.ts +407 -160
- package/dist/components/DescriptionList/styled.js +5 -4
- package/dist/components/Disclosure/Disclosure.js +4 -3
- package/dist/components/Em/Em.d.ts +407 -160
- package/dist/components/ErrorText/ErrorText.d.ts +407 -160
- package/dist/components/ErrorText/ErrorText.js +2 -3
- package/dist/components/FilterSelect/FilterSelect.js +5 -4
- package/dist/components/Grid/Col.d.ts +407 -160
- package/dist/components/Grid/Col.js +3 -3
- package/dist/components/Grid/Row.d.ts +407 -160
- package/dist/components/Grid/Row.js +4 -4
- package/dist/components/Heading1/Heading1.d.ts +3 -1
- package/dist/components/Heading1/Heading1.js +6 -4
- package/dist/components/Heading2/Heading2.d.ts +3 -1
- package/dist/components/Heading2/Heading2.js +6 -4
- package/dist/components/Heading3/Heading3.d.ts +3 -1
- package/dist/components/Heading3/Heading3.js +6 -4
- package/dist/components/Heading4/Heading4.d.ts +3 -1
- package/dist/components/Heading4/Heading4.js +6 -4
- package/dist/components/HintText/HintText.d.ts +407 -160
- package/dist/components/HintText/HintText.js +2 -3
- package/dist/components/Input/Input.js +7 -4
- package/dist/components/Label/Label.d.ts +5 -241
- package/dist/components/Label/Label.js +17 -4
- package/dist/components/LabelText/LabelText.d.ts +407 -160
- package/dist/components/LabelText/LabelText.js +2 -1
- package/dist/components/Lead/Lead.d.ts +5 -241
- package/dist/components/Lead/Lead.js +19 -4
- package/dist/components/LineThrough/LineThrough.d.ts +407 -160
- package/dist/components/List/styled.d.ts +1636 -648
- package/dist/components/List/styled.js +4 -4
- package/dist/components/Margin/Margin.d.ts +408 -162
- package/dist/components/Margin/Margin.js +2 -3
- package/dist/components/NavHeader/NavHeader.d.ts +10 -2
- package/dist/components/NavHeader/NavHeader.js +25 -29
- package/dist/components/NavHeader/NavHeader.styles.d.ts +3845 -1387
- package/dist/components/NavHeader/NavHeader.styles.js +18 -17
- package/dist/components/Notification/Notification.d.ts +816 -322
- package/dist/components/Notification/Notification.js +18 -15
- package/dist/components/P/P.d.ts +2 -0
- package/dist/components/P/P.js +3 -2
- package/dist/components/PasswordInput/PasswordInput.styled.d.ts +407 -160
- package/dist/components/PasswordInput/PasswordInput.styled.js +2 -1
- package/dist/components/{HorizontalCarousel/HorizontalCarousel.d.ts → ProductCarousel/ProductCarousel.d.ts} +2 -2
- package/dist/components/ProductCarousel/ProductCarousel.js +128 -0
- package/dist/components/ProductCarousel/anchor-point.d.ts +10 -0
- package/dist/components/ProductCarousel/anchor-point.js +53 -0
- package/dist/components/ProductCarousel/index.d.ts +1 -0
- package/dist/components/ProductCarousel/index.js +5 -0
- package/dist/components/Radio/Radio.js +5 -4
- package/dist/components/RadioCard/RadioCard.d.ts +9 -0
- package/dist/components/RadioCard/RadioCard.js +72 -0
- package/dist/components/RadioCard/index.d.ts +1 -0
- package/dist/components/RadioCard/index.js +5 -0
- package/dist/components/SelectField/Select.d.ts +407 -160
- package/dist/components/SelectField/Select.js +8 -7
- package/dist/components/SkeletonCTA/SkeletonCTA.js +2 -1
- package/dist/components/SkeletonCircle/SkeletonCircle.js +2 -2
- package/dist/components/SkeletonText/SkeletonText.js +4 -1
- package/dist/components/Small/Small.d.ts +407 -160
- package/dist/components/Small/Small.js +2 -1
- package/dist/components/Stack/Stack.d.ts +1 -2
- package/dist/components/Stack/Stack.js +2 -1
- package/dist/components/Strong/Strong.d.ts +407 -160
- package/dist/components/SubLabelText/SubLabelText.d.ts +407 -160
- package/dist/components/SubLabelText/SubLabelText.js +2 -1
- package/dist/components/Tabs/Tab.js +8 -7
- package/dist/components/Tabs/TabList.js +2 -1
- package/dist/components/Tabs/TabPanel.js +2 -1
- package/dist/components/Tabs/Tabs.js +2 -1
- package/dist/components/TextareaInput/TextareaInput.js +2 -2
- package/dist/components/Toast/Toast.js +3 -2
- package/dist/components/Toggle/Toggle.js +2 -2
- package/dist/components/Toggle/styles.d.ts +1638 -650
- package/dist/components/Toggle/styles.js +5 -4
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/esm/components/Accordion/Accordion.js +4 -9
- package/dist/esm/components/Accordion/styles.js +4 -3
- package/dist/esm/components/ActionCard/ActionCard.js +4 -3
- package/dist/esm/components/ActionList/ActionList.js +2 -1
- package/dist/esm/components/ActionList/styled.js +6 -5
- package/dist/esm/components/Badge/Badge.js +3 -2
- package/dist/esm/components/CTAButton/CTAButton.js +7 -6
- package/dist/esm/components/Card/Card.js +5 -4
- package/dist/esm/components/Checkbox/Checkbox.js +4 -3
- package/dist/esm/components/DataTable/styles.js +14 -15
- package/dist/esm/components/DateField/DateField.js +4 -3
- package/dist/esm/components/DescriptionList/styled.js +5 -4
- package/dist/esm/components/Disclosure/Disclosure.js +4 -3
- package/dist/esm/components/ErrorText/ErrorText.js +2 -3
- package/dist/esm/components/FilterSelect/FilterSelect.js +5 -4
- package/dist/esm/components/Grid/Col.js +3 -3
- package/dist/esm/components/Grid/Row.js +4 -4
- package/dist/esm/components/Heading1/Heading1.js +5 -3
- package/dist/esm/components/Heading2/Heading2.js +5 -3
- package/dist/esm/components/Heading3/Heading3.js +5 -3
- package/dist/esm/components/Heading4/Heading4.js +5 -3
- package/dist/esm/components/HintText/HintText.js +2 -3
- package/dist/esm/components/Input/Input.js +7 -4
- package/dist/esm/components/Label/Label.js +17 -4
- package/dist/esm/components/LabelText/LabelText.js +2 -1
- package/dist/esm/components/Lead/Lead.js +19 -4
- package/dist/esm/components/List/styled.js +4 -4
- package/dist/esm/components/Margin/Margin.js +2 -3
- package/dist/esm/components/NavHeader/NavHeader.js +26 -30
- package/dist/esm/components/NavHeader/NavHeader.styles.js +17 -16
- package/dist/esm/components/Notification/Notification.js +18 -15
- package/dist/esm/components/P/P.js +3 -2
- package/dist/esm/components/PasswordInput/PasswordInput.styled.js +2 -1
- package/dist/esm/components/ProductCarousel/ProductCarousel.js +98 -0
- package/dist/esm/components/ProductCarousel/anchor-point.js +49 -0
- package/dist/esm/components/ProductCarousel/index.js +1 -0
- package/dist/esm/components/Radio/Radio.js +5 -4
- package/dist/esm/components/RadioCard/RadioCard.js +66 -0
- package/dist/esm/components/RadioCard/index.js +1 -0
- package/dist/esm/components/SelectField/Select.js +8 -7
- package/dist/esm/components/SkeletonCTA/SkeletonCTA.js +2 -1
- package/dist/esm/components/SkeletonCircle/SkeletonCircle.js +1 -1
- package/dist/esm/components/SkeletonText/SkeletonText.js +4 -1
- package/dist/esm/components/Small/Small.js +2 -1
- package/dist/esm/components/Stack/Stack.js +2 -1
- package/dist/esm/components/SubLabelText/SubLabelText.js +2 -1
- package/dist/esm/components/Tabs/Tab.js +9 -8
- package/dist/esm/components/Tabs/TabList.js +2 -1
- package/dist/esm/components/Tabs/TabPanel.js +2 -1
- package/dist/esm/components/Tabs/Tabs.js +2 -1
- package/dist/esm/components/TextareaInput/TextareaInput.js +2 -2
- package/dist/esm/components/Toast/Toast.js +3 -2
- package/dist/esm/components/Toggle/Toggle.js +2 -2
- package/dist/esm/components/Toggle/styles.js +5 -4
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/utils/utils.js +1 -7
- package/dist/styled.native.d.ts +2523 -1041
- package/dist/utils/utils.d.ts +1 -3
- package/dist/utils/utils.js +1 -9
- package/package.json +5 -4
- package/dist/components/HorizontalCarousel/HorizontalCarousel.js +0 -92
- package/dist/components/HorizontalCarousel/index.d.ts +0 -1
- package/dist/components/HorizontalCarousel/index.js +0 -17
- package/dist/esm/components/HorizontalCarousel/HorizontalCarousel.js +0 -62
- package/dist/esm/components/HorizontalCarousel/index.js +0 -1
- /package/dist/components/{HorizontalCarousel → ProductCarousel}/NavigationDots.d.ts +0 -0
- /package/dist/components/{HorizontalCarousel → ProductCarousel}/NavigationDots.js +0 -0
- /package/dist/esm/components/{HorizontalCarousel → ProductCarousel}/NavigationDots.js +0 -0
|
@@ -2,13 +2,13 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
2
2
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
|
+
import { numToPx } from '@ovotech/element-core';
|
|
5
6
|
import styled, { css } from '../../styled.native';
|
|
6
7
|
import { styledComponentWithBreakpoints } from '../../utils';
|
|
7
|
-
import { pxToNumber } from '../../utils/utils';
|
|
8
8
|
var StyledCol = styled.View(function (_a) {
|
|
9
9
|
var core = _a.theme.core, _b = _a.span, span = _b === void 0 ? 12 : _b, small = _a.small, medium = _a.medium, large = _a.large, smallAndUp = _a.smallAndUp, mediumAndUp = _a.mediumAndUp, largeAndUp = _a.largeAndUp;
|
|
10
10
|
var gutter = [core.space[4], core.space[8]];
|
|
11
|
-
var halfGutter = gutter.map(function (g) { return
|
|
11
|
+
var halfGutter = gutter.map(function (g) { return g / 2; });
|
|
12
12
|
var smallScreen = !smallAndUp;
|
|
13
13
|
var percentage = (span / 12) * 100;
|
|
14
14
|
var smallPercentage = small ? (small / 12) * 100 : percentage;
|
|
@@ -26,7 +26,7 @@ var StyledCol = styled.View(function (_a) {
|
|
|
26
26
|
? mediumPercentage
|
|
27
27
|
: smallAndUp
|
|
28
28
|
? smallPercentage
|
|
29
|
-
: percentage, smallScreen ? halfGutter[0] : halfGutter[1], smallScreen ? halfGutter[0] : halfGutter[1], smallScreen ? gutter[0] : gutter[1]);
|
|
29
|
+
: percentage, numToPx(smallScreen ? halfGutter[0] : halfGutter[1]), numToPx(smallScreen ? halfGutter[0] : halfGutter[1]), numToPx(smallScreen ? gutter[0] : gutter[1]));
|
|
30
30
|
});
|
|
31
31
|
var Col = styledComponentWithBreakpoints(StyledCol);
|
|
32
32
|
export { Col };
|
|
@@ -25,16 +25,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
+
import { numToPx } from '@ovotech/element-core';
|
|
28
29
|
import styled, { css } from '../../styled.native';
|
|
29
30
|
import { styledComponentWithBreakpoints } from '../../utils';
|
|
30
|
-
import { pxToNumber } from '../../utils/utils';
|
|
31
31
|
var StyledRow = styled.View(function (_a) {
|
|
32
32
|
var core = _a.theme.core, isNested = _a.isNested, smallAndUp = _a.smallAndUp;
|
|
33
33
|
var gutter = [core.space[4], core.space[8]];
|
|
34
|
-
var halfGutter = gutter.map(function (g) { return
|
|
34
|
+
var halfGutter = gutter.map(function (g) { return g / 2; });
|
|
35
35
|
var smallScreen = !smallAndUp;
|
|
36
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-left: ", ";\n padding-right: ", ";\n margin: 0 auto;\n width: ", "px;\n max-width: 100%;\n margin-bottom: -", ";\n\n ", "\n "], ["\n padding-left: ", ";\n padding-right: ", ";\n margin: 0 auto;\n width: ", "px;\n max-width: 100%;\n margin-bottom: -", ";\n\n ", "\n "])), smallScreen ? halfGutter[0] : halfGutter[1], smallScreen ? halfGutter[0] : halfGutter[1], core.breakpoint.large, smallScreen ? gutter[0] : gutter[1], isNested
|
|
37
|
-
? "\n margin-left: -".concat(smallScreen ? gutter[0] : gutter[1], ";\n margin-right: -").concat(smallScreen ? gutter[0] : gutter[1], ";\n width: auto;\n max-width: 200%; /* max width none not supported in RN */\n ")
|
|
36
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-left: ", ";\n padding-right: ", ";\n margin: 0 auto;\n width: ", "px;\n max-width: 100%;\n margin-bottom: -", ";\n\n ", "\n "], ["\n padding-left: ", ";\n padding-right: ", ";\n margin: 0 auto;\n width: ", "px;\n max-width: 100%;\n margin-bottom: -", ";\n\n ", "\n "])), numToPx(smallScreen ? halfGutter[0] : halfGutter[1]), numToPx(smallScreen ? halfGutter[0] : halfGutter[1]), core.breakpoint.large, numToPx(smallScreen ? gutter[0] : gutter[1]), isNested
|
|
37
|
+
? "\n margin-left: -".concat(numToPx(smallScreen ? gutter[0] : gutter[1]), ";\n margin-right: -").concat(numToPx(smallScreen ? gutter[0] : gutter[1]), ";\n width: auto;\n max-width: 200%; /* max width none not supported in RN */\n ")
|
|
38
38
|
: null);
|
|
39
39
|
});
|
|
40
40
|
var WidthRow = styledComponentWithBreakpoints(StyledRow);
|
|
@@ -25,16 +25,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
+
import { pxToNumber, numToPx } from '@ovotech/element-core';
|
|
28
29
|
import { useBreakpoint } from '../../hooks';
|
|
29
30
|
import styled, { css } from '../../styled.native';
|
|
30
|
-
import { pxToNumber, numToPx } from '../../utils';
|
|
31
31
|
var calculateLetterSpacing = function (fontSize, letterSpacing) {
|
|
32
32
|
return numToPx(pxToNumber(fontSize) * letterSpacing);
|
|
33
33
|
};
|
|
34
34
|
var StyledHeading1 = styled.Text(function (_a) {
|
|
35
|
-
var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
|
|
35
|
+
var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp, inverted = _a.inverted;
|
|
36
36
|
var fontSize = core.fontSize.heading1[smallAndUp ? 'large' : 'small'];
|
|
37
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, fontSize, core.lineHeight.heading1[smallAndUp ? 'large' : 'small'], calculateLetterSpacing(fontSize, core.letterSpacing.extraCompressed),
|
|
37
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, numToPx(fontSize), numToPx(core.lineHeight.heading1[smallAndUp ? 'large' : 'small']), calculateLetterSpacing(String(fontSize), core.letterSpacing.extraCompressed), inverted
|
|
38
|
+
? semantic.inverted.message.link
|
|
39
|
+
: semantic.message.branded);
|
|
38
40
|
});
|
|
39
41
|
export var Heading1 = function (_a) {
|
|
40
42
|
var _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'header' : _b, rest = __rest(_a, ["accessibilityRole"]);
|
|
@@ -25,16 +25,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
+
import { pxToNumber, numToPx } from '@ovotech/element-core';
|
|
28
29
|
import { useBreakpoint } from '../../hooks';
|
|
29
30
|
import styled, { css } from '../../styled.native';
|
|
30
|
-
import { pxToNumber, numToPx } from '../../utils';
|
|
31
31
|
var calculateLetterSpacing = function (fontSize, letterSpacing) {
|
|
32
32
|
return numToPx(pxToNumber(fontSize) * letterSpacing);
|
|
33
33
|
};
|
|
34
34
|
var StyledHeading2 = styled.Text(function (_a) {
|
|
35
|
-
var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
|
|
35
|
+
var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp, inverted = _a.inverted;
|
|
36
36
|
var fontSize = core.fontSize.heading2[smallAndUp ? 'large' : 'small'];
|
|
37
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, fontSize, core.lineHeight.heading2[smallAndUp ? 'large' : 'small'], calculateLetterSpacing(fontSize, core.letterSpacing.extraCompressed),
|
|
37
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, numToPx(fontSize), numToPx(core.lineHeight.heading2[smallAndUp ? 'large' : 'small']), calculateLetterSpacing(String(fontSize), core.letterSpacing.extraCompressed), inverted
|
|
38
|
+
? semantic.inverted.message.link
|
|
39
|
+
: semantic.message.branded);
|
|
38
40
|
});
|
|
39
41
|
export var Heading2 = function (_a) {
|
|
40
42
|
var _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'header' : _b, rest = __rest(_a, ["accessibilityRole"]);
|
|
@@ -25,16 +25,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
+
import { pxToNumber, numToPx } from '@ovotech/element-core';
|
|
28
29
|
import { useBreakpoint } from '../../hooks';
|
|
29
30
|
import styled, { css } from '../../styled.native';
|
|
30
|
-
import { pxToNumber, numToPx } from '../../utils';
|
|
31
31
|
var calculateLetterSpacing = function (fontSize, letterSpacing) {
|
|
32
32
|
return numToPx(pxToNumber(fontSize) * letterSpacing);
|
|
33
33
|
};
|
|
34
34
|
var StyledHeading3 = styled.Text(function (_a) {
|
|
35
|
-
var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
|
|
35
|
+
var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp, inverted = _a.inverted;
|
|
36
36
|
var fontSize = core.fontSize.heading3[smallAndUp ? 'large' : 'small'];
|
|
37
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.bodyBold.native, fontSize, core.lineHeight.heading3[smallAndUp ? 'large' : 'small'], calculateLetterSpacing(fontSize, core.letterSpacing.compressed),
|
|
37
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.bodyBold.native, numToPx(fontSize), numToPx(core.lineHeight.heading3[smallAndUp ? 'large' : 'small']), calculateLetterSpacing(String(fontSize), core.letterSpacing.compressed), inverted
|
|
38
|
+
? semantic.inverted.message.link
|
|
39
|
+
: semantic.message.branded);
|
|
38
40
|
});
|
|
39
41
|
export var Heading3 = function (_a) {
|
|
40
42
|
var _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'header' : _b, rest = __rest(_a, ["accessibilityRole"]);
|
|
@@ -25,16 +25,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
+
import { pxToNumber, numToPx } from '@ovotech/element-core';
|
|
28
29
|
import { useBreakpoint } from '../../hooks';
|
|
29
30
|
import styled, { css } from '../../styled.native';
|
|
30
|
-
import { pxToNumber, numToPx } from '../../utils';
|
|
31
31
|
var calculateLetterSpacing = function (fontSize, letterSpacing) {
|
|
32
32
|
return numToPx(pxToNumber(fontSize) * letterSpacing);
|
|
33
33
|
};
|
|
34
34
|
var StyledHeading4 = styled.Text(function (_a) {
|
|
35
|
-
var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
|
|
35
|
+
var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp, inverted = _a.inverted;
|
|
36
36
|
var fontSize = core.fontSize.heading4[smallAndUp ? 'large' : 'small'];
|
|
37
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.bodyBold.native, fontSize, core.lineHeight.heading4[smallAndUp ? 'large' : 'small'], calculateLetterSpacing(fontSize, core.letterSpacing.compressed),
|
|
37
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n letter-spacing: ", ";\n color: ", ";\n "])), core.fontFamily.bodyBold.native, numToPx(fontSize), numToPx(core.lineHeight.heading4[smallAndUp ? 'large' : 'small']), calculateLetterSpacing(String(fontSize), core.letterSpacing.compressed), inverted
|
|
38
|
+
? semantic.inverted.message.link
|
|
39
|
+
: semantic.message.branded);
|
|
38
40
|
});
|
|
39
41
|
export var Heading4 = function (_a) {
|
|
40
42
|
var _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'header' : _b, rest = __rest(_a, ["accessibilityRole"]);
|
|
@@ -2,6 +2,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
2
2
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
|
+
import { numToPx } from '@ovotech/element-core';
|
|
5
6
|
import styled, { css } from '../../styled.native';
|
|
6
7
|
import { styledComponentWithBreakpoints } from '../../utils';
|
|
7
8
|
var StyledHintText = styled.Text(function (_a) {
|
|
@@ -9,9 +10,7 @@ var StyledHintText = styled.Text(function (_a) {
|
|
|
9
10
|
var fontSize = smallAndUp
|
|
10
11
|
? core.fontSize.body.large
|
|
11
12
|
: core.fontSize.body.small;
|
|
12
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.body.native, fontSize, smallAndUp
|
|
13
|
-
? core.lineHeight.body.large
|
|
14
|
-
: core.lineHeight.body.small, semantic.border.functional);
|
|
13
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.body.native, numToPx(fontSize), numToPx(smallAndUp ? core.lineHeight.body.large : core.lineHeight.body.small), semantic.border.functional);
|
|
15
14
|
});
|
|
16
15
|
var HintText = styledComponentWithBreakpoints(StyledHintText);
|
|
17
16
|
export { HintText };
|
|
@@ -25,13 +25,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
27
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
|
+
import { numToPx } from '@ovotech/element-core';
|
|
28
29
|
import { forwardRef, useState } from 'react';
|
|
29
30
|
import { useBreakpoint } from '../../hooks';
|
|
30
31
|
import styled, { css } from '../../styled.native';
|
|
31
32
|
import { Icon } from '../Icon/Icon';
|
|
32
33
|
var StyledIcon = styled(Icon)(function (_a) {
|
|
33
34
|
var core = _a.theme.core, side = _a.side, focused = _a.focused;
|
|
34
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n z-index: 1;\n top: ", ";\n ", ";\n ", ";\n "], ["\n position: absolute;\n z-index: 1;\n top: ", ";\n ", ";\n ", ";\n "])), focused ? '16px' : '14px', side === 'left' ? "left: ".concat(core.space[2]) : '', side === 'right' ? "right: ".concat(core.space[2]) : '');
|
|
35
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n z-index: 1;\n top: ", ";\n ", ";\n ", ";\n "], ["\n position: absolute;\n z-index: 1;\n top: ", ";\n ", ";\n ", ";\n "])), focused ? '16px' : '14px', side === 'left' ? "left: ".concat(numToPx(core.space[2])) : '', side === 'right' ? "right: ".concat(numToPx(core.space[2])) : '');
|
|
35
36
|
});
|
|
36
37
|
var Input = forwardRef(function (_a, ref) {
|
|
37
38
|
var onFocus = _a.onFocus, onBlur = _a.onBlur, style = _a.style, iconLeft = _a.iconLeft, iconRight = _a.iconRight, rightSlot = _a.rightSlot, rest = __rest(_a, ["onFocus", "onBlur", "style", "iconLeft", "iconRight", "rightSlot"]);
|
|
@@ -53,8 +54,8 @@ var Input = forwardRef(function (_a, ref) {
|
|
|
53
54
|
});
|
|
54
55
|
var InputWrapper = styled.View(function (_a) {
|
|
55
56
|
var _b = _a.theme, core = _b.core, semantic = _b.semantic, focused = _a.focused;
|
|
56
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-self: stretch;\n border-radius: ", ";\n border-width: 0;\n border-style: solid;\n border-color: ", ";\n flex-direction: row;\n\n ", "\n "], ["\n align-self: stretch;\n border-radius: ", ";\n border-width: 0;\n border-style: solid;\n border-color: ", ";\n flex-direction: row;\n\n ", "\n "])), core.radius.small, semantic.border.functional, focused
|
|
57
|
-
? "\n border-width: ".concat(core.borderWidth.small, ";\n border-color: ").concat(semantic.focus.outline, ";\n padding: 2px;\n margin: -4px;")
|
|
57
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-self: stretch;\n border-radius: ", ";\n border-width: 0;\n border-style: solid;\n border-color: ", ";\n flex-direction: row;\n\n ", "\n "], ["\n align-self: stretch;\n border-radius: ", ";\n border-width: 0;\n border-style: solid;\n border-color: ", ";\n flex-direction: row;\n\n ", "\n "])), numToPx(core.radius.small), semantic.border.functional, focused
|
|
58
|
+
? "\n border-width: ".concat(numToPx(core.borderWidth.small), ";\n border-color: ").concat(semantic.focus.outline, ";\n padding: 2px;\n margin: -4px;")
|
|
58
59
|
: null);
|
|
59
60
|
});
|
|
60
61
|
var StyledInput = styled.TextInput(function (_a) {
|
|
@@ -65,7 +66,9 @@ var StyledInput = styled.TextInput(function (_a) {
|
|
|
65
66
|
var errorStyles = invalid
|
|
66
67
|
? "\n border-color: ".concat(semantic.message.error, ";\n ")
|
|
67
68
|
: '';
|
|
68
|
-
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n
|
|
69
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-family: ", ";\n color: ", ";\n font-size: ", ";\n height: ", ";\n line-height: 18px; /* Corrects for responsive line height in fixed height input */\n border: ", " solid\n ", ";\n border-radius: ", ";\n padding: 0 ", ";\n flex: 1;\n\n ", "\n ", "\n\n ", "\n "], ["\n font-family: ", ";\n color: ", ";\n font-size: ", ";\n height: ", ";\n line-height: 18px; /* Corrects for responsive line height in fixed height input */\n border: ", " solid\n ", ";\n border-radius: ", ";\n padding: 0 ", ";\n flex: 1;\n\n ", "\n ", "\n\n ", "\n "])), core.fontFamily.body.native, semantic.message.base, numToPx(fontSize), numToPx(core.space[11]), numToPx(core.borderWidth.small), semantic.border.functional, numToPx(core.radius.small), numToPx(core.space[2]), iconLeft ? "padding-left: ".concat(numToPx(core.space[8]), ";") : '', iconRight || hasRightSlot
|
|
70
|
+
? "padding-right: ".concat(numToPx(core.space[8]), ";")
|
|
71
|
+
: '', errorStyles);
|
|
69
72
|
});
|
|
70
73
|
export { Input };
|
|
71
74
|
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -2,11 +2,24 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
2
2
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import { numToPx } from '@ovotech/element-core';
|
|
18
|
+
import { forwardRef } from 'react';
|
|
5
19
|
import styled, { css } from '../../styled.native';
|
|
6
|
-
import { styledComponentWithBreakpoints } from '../../utils';
|
|
7
20
|
var StyledLabel = styled.Text(function (_a) {
|
|
8
|
-
var
|
|
9
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n "])), core.fontFamily.body.native, core.fontSize.label[smallAndUp ? 'large' : 'small'], core.lineHeight.label[smallAndUp ? 'large' : 'small']);
|
|
21
|
+
var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp, inverted = _a.inverted;
|
|
22
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.body.native, numToPx(core.fontSize.label[smallAndUp ? 'large' : 'small']), numToPx(core.lineHeight.label[smallAndUp ? 'large' : 'small']), inverted ? semantic.inverted.message.base : semantic.message.base);
|
|
10
23
|
});
|
|
11
|
-
export var Label =
|
|
24
|
+
export var Label = forwardRef(function (props, ref) { return (_jsx(StyledLabel, __assign({}, props, { ref: ref }))); });
|
|
12
25
|
var templateObject_1;
|
|
@@ -2,6 +2,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
2
2
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
|
+
import { numToPx } from '@ovotech/element-core';
|
|
5
6
|
import styled, { css } from '../../styled.native';
|
|
6
7
|
import { styledComponentWithBreakpoints } from '../../utils';
|
|
7
8
|
var StyledLabelText = styled.Text(function (_a) {
|
|
@@ -9,7 +10,7 @@ var StyledLabelText = styled.Text(function (_a) {
|
|
|
9
10
|
var fontSize = smallAndUp
|
|
10
11
|
? core.fontSize.body.large
|
|
11
12
|
: core.fontSize.body.small;
|
|
12
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "], ["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "])), core.fontFamily.bodyBold.native, core.lineHeight.body.small, semantic.message.base, fontSize);
|
|
13
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "], ["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "])), core.fontFamily.bodyBold.native, numToPx(core.lineHeight.body.small), semantic.message.base, numToPx(fontSize));
|
|
13
14
|
});
|
|
14
15
|
var LabelText = styledComponentWithBreakpoints(StyledLabelText);
|
|
15
16
|
export { LabelText };
|
|
@@ -2,11 +2,26 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
2
2
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import { numToPx } from '@ovotech/element-core';
|
|
18
|
+
import { forwardRef } from 'react';
|
|
5
19
|
import styled, { css } from '../../styled.native';
|
|
6
|
-
import { styledComponentWithBreakpoints } from '../../utils';
|
|
7
20
|
var StyledLead = styled.Text(function (_a) {
|
|
8
|
-
var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
|
|
9
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.body.native, core.fontSize.lead[smallAndUp ? 'large' : 'small'], core.lineHeight.lead[smallAndUp ? 'large' : 'small'],
|
|
21
|
+
var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp, inverted = _a.inverted;
|
|
22
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.body.native, numToPx(core.fontSize.lead[smallAndUp ? 'large' : 'small']), numToPx(core.lineHeight.lead[smallAndUp ? 'large' : 'small']), inverted
|
|
23
|
+
? semantic.inverted.message.link
|
|
24
|
+
: semantic.message.branded);
|
|
10
25
|
});
|
|
11
|
-
export var Lead =
|
|
26
|
+
export var Lead = forwardRef(function (props, ref) { return (_jsx(StyledLead, __assign({}, props, { ref: ref }))); });
|
|
12
27
|
var templateObject_1;
|
|
@@ -2,15 +2,15 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
2
2
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
|
+
import { numToPx } from '@ovotech/element-core';
|
|
5
6
|
import styled, { css } from '../../styled.native';
|
|
6
|
-
import { pxToNumber } from '../../utils';
|
|
7
7
|
export var SquareBullet = styled.View(function (_a) {
|
|
8
8
|
var _b = _a.theme, core = _b.core, semantic = _b.semantic, visible = _a.visible, smallAndUp = _a.smallAndUp;
|
|
9
9
|
var lineHeight = smallAndUp
|
|
10
10
|
? core.lineHeight.body.large
|
|
11
11
|
: core.lineHeight.body.small;
|
|
12
|
-
var topMargin = (
|
|
13
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-self: flex-start;\n width: ", ";\n height: ", ";\n margin-right: ", ";\n margin-top: ", "
|
|
12
|
+
var topMargin = (lineHeight - core.space[2]) / 2;
|
|
13
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-self: flex-start;\n width: ", ";\n height: ", ";\n margin-right: ", ";\n margin-top: ", ";\n background-color: ", ";\n "], ["\n align-self: flex-start;\n width: ", ";\n height: ", ";\n margin-right: ", ";\n margin-top: ", ";\n background-color: ", ";\n "])), numToPx(core.space[2]), numToPx(core.space[2]), numToPx(core.space[2]), numToPx(topMargin), visible ? semantic.message.base : 'transparent');
|
|
14
14
|
});
|
|
15
15
|
export var TextBullet = styled.Text(function (_a) {
|
|
16
16
|
var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp;
|
|
@@ -20,7 +20,7 @@ export var TextBullet = styled.Text(function (_a) {
|
|
|
20
20
|
var lineHeight = smallAndUp
|
|
21
21
|
? core.lineHeight.body.large
|
|
22
22
|
: core.lineHeight.body.small;
|
|
23
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-right: ", ";\n min-width: ", ";\n min-height: ", ";\n font-size: ", ";\n line-height: ", ";\n text-align: left;\n color: ", ";\n "], ["\n margin-right: ", ";\n min-width: ", ";\n min-height: ", ";\n font-size: ", ";\n line-height: ", ";\n text-align: left;\n color: ", ";\n "])), core.space[1], core.space[3], core.space[3], fontSize, lineHeight, semantic.message.base);
|
|
23
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-right: ", ";\n min-width: ", ";\n min-height: ", ";\n font-size: ", ";\n line-height: ", ";\n text-align: left;\n color: ", ";\n "], ["\n margin-right: ", ";\n min-width: ", ";\n min-height: ", ";\n font-size: ", ";\n line-height: ", ";\n text-align: left;\n color: ", ";\n "])), numToPx(core.space[1]), numToPx(core.space[3]), numToPx(core.space[3]), numToPx(fontSize), numToPx(lineHeight), semantic.message.base);
|
|
24
24
|
});
|
|
25
25
|
export var FlexRow = styled.View(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n"], ["\n flex-direction: row;\n"])));
|
|
26
26
|
export var LiContent = styled.View(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n flex-direction: column;\n flex: 1;\n"], ["\n flex-direction: column;\n flex: 1;\n"])));
|
|
@@ -21,14 +21,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { numToPx } from '@ovotech/element-core';
|
|
24
25
|
import { useBreakpoint } from '../../hooks';
|
|
25
26
|
import styled from '../../styled.native';
|
|
26
27
|
import { responsiveStyle } from '../../utils';
|
|
27
28
|
var StyledMargin = styled.View(function (_a) {
|
|
28
29
|
var space = _a.theme.core.space, mTop = _a.mTop, mBottom = _a.mBottom, mLeft = _a.mLeft, mRight = _a.mRight, horizontal = _a.horizontal, vertical = _a.vertical, all = _a.all, breakpoints = _a.breakpoints;
|
|
29
|
-
var formatter = function (spaceKey) {
|
|
30
|
-
return spaceKey === 0 ? '0' : space[spaceKey];
|
|
31
|
-
};
|
|
30
|
+
var formatter = function (spaceKey) { return numToPx(space[spaceKey]); };
|
|
32
31
|
return "\n ".concat(horizontal
|
|
33
32
|
? "\n ".concat(responsiveStyle('margin-left', horizontal, breakpoints, formatter), "\n ").concat(responsiveStyle('margin-right', horizontal, breakpoints, formatter), "\n ")
|
|
34
33
|
: '', "\n ").concat(vertical
|
|
@@ -11,47 +11,43 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { theme } from '@ovotech/element-core';
|
|
14
|
-
import { useEffect } from 'react';
|
|
15
14
|
import Animated, { Easing, FadeInDown, FadeInUp, FadeOutDown, FadeOutUp, useAnimatedStyle, useSharedValue, withTiming, } from 'react-native-reanimated';
|
|
16
15
|
import { Action } from '../ActionList';
|
|
17
16
|
import { IconButton } from './IconButton';
|
|
18
|
-
import { ActionWrapper, CollapsedTitle, CollapsedTitleWrapper, ExpandedTitle, IconButtonWrapper, NavContainer, } from './NavHeader.styles';
|
|
17
|
+
import { ActionWrapper, CollapsedTitle, CollapsedTitleWrapper, ExpandedTitle, IconButtonWrapper, NavContainer, NavWrapper, } from './NavHeader.styles';
|
|
19
18
|
var FADE_ANIMATION_DURATION = 200;
|
|
20
|
-
var ONLY_TITLE_CONTAINER_HEIGHT = 108;
|
|
21
|
-
var TITLE_AND_BACK_CONTAINER_HEIGHT = 92;
|
|
22
19
|
export var NavHeader = function (_a) {
|
|
23
|
-
var title = _a.title, scrolled = _a.scrolled, rightActionConfig = _a.rightActionConfig,
|
|
20
|
+
var title = _a.title, scrolled = _a.scrolled, canGoBack = _a.canGoBack, rightActionConfig = _a.rightActionConfig, _b = _a.topOffset, topOffset = _b === void 0 ? 0 : _b, _c = _a.backButtonText, backButtonText = _c === void 0 ? 'Back' : _c, onHeaderHeightChange = _a.onHeaderHeightChange, onBackButtonPress = _a.onBackButtonPress;
|
|
24
21
|
var hasRightAction = !!rightActionConfig;
|
|
25
|
-
var
|
|
26
|
-
? TITLE_AND_BACK_CONTAINER_HEIGHT
|
|
27
|
-
: ONLY_TITLE_CONTAINER_HEIGHT;
|
|
28
|
-
var animatedContainerHeight = useSharedValue(initialContainerHeight);
|
|
22
|
+
var layoutHeight = useSharedValue(0);
|
|
29
23
|
var animatedHeightStyle = useAnimatedStyle(function () {
|
|
30
24
|
return {
|
|
31
|
-
height:
|
|
25
|
+
height: layoutHeight.value,
|
|
32
26
|
};
|
|
33
27
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
easing: Easing.linear,
|
|
39
|
-
});
|
|
28
|
+
var onLayout = function (e) {
|
|
29
|
+
var height = e.nativeEvent.layout.height;
|
|
30
|
+
if (height === layoutHeight.value) {
|
|
31
|
+
return;
|
|
40
32
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
easing: Easing.linear,
|
|
45
|
-
});
|
|
33
|
+
// we want to only update height of the expanded header to set content offset on the client side
|
|
34
|
+
if (!scrolled) {
|
|
35
|
+
onHeaderHeightChange === null || onHeaderHeightChange === void 0 ? void 0 : onHeaderHeightChange(height);
|
|
46
36
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
37
|
+
layoutHeight.value = withTiming(height, {
|
|
38
|
+
duration: FADE_ANIMATION_DURATION,
|
|
39
|
+
easing: Easing.linear,
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
// NavWrapper will recieve height of the NavContainer and animate it
|
|
43
|
+
// content inside NavContainer is the only dynamic part of NavHeader
|
|
44
|
+
return (_jsx(NavWrapper, __assign({ collapsed: scrolled, style: animatedHeightStyle }, { children: _jsxs(NavContainer, __assign({ topOffset: topOffset, onLayout: onLayout }, { children: [_jsx(Animated.View, __assign({ style: {
|
|
45
|
+
width: scrolled ? '33.3%' : '100%',
|
|
46
|
+
// when back button is off we have small margin top for title, to write less code we can just set height
|
|
47
|
+
height: !canGoBack ? parseInt(theme.core.space[10]) : undefined,
|
|
48
|
+
} }, { children: canGoBack && (_jsx(ActionWrapper, __assign({ collapsed: scrolled }, { children: _jsx(Action, __assign({ iconLeft: "chevron-left-small", inline: true, onPress: onBackButtonPress }, { children: backButtonText })) }))) })), scrolled ? (_jsxs(_Fragment, { children: [_jsx(CollapsedTitleWrapper, { children: _jsx(CollapsedTitle, __assign({ numberOfLines: 1, ellipsizeMode: "tail", entering: FadeInDown.delay(FADE_ANIMATION_DURATION), exiting: FadeOutDown.duration(FADE_ANIMATION_DURATION) }, { children: title })) }), _jsx(IconButtonWrapper, { children: _jsx(IconButton, { rightActionConfig: rightActionConfig, size: "small", animation: FadeInDown.delay(FADE_ANIMATION_DURATION) }) })] })) : (_jsxs(_Fragment, { children: [_jsx(ExpandedTitle
|
|
55
49
|
// if we don't have right action leave more space for the title text in expanded state
|
|
56
|
-
|
|
50
|
+
, __assign({
|
|
51
|
+
// if we don't have right action leave more space for the title text in expanded state
|
|
52
|
+
fullWidth: !scrolled && !hasRightAction, numberOfLines: 2, ellipsizeMode: "tail", hasBackButton: canGoBack, entering: FadeInUp.delay(FADE_ANIMATION_DURATION), exiting: FadeOutUp.duration(FADE_ANIMATION_DURATION) }, { children: title })), _jsx(IconButtonWrapper, { children: _jsx(IconButton, { rightActionConfig: rightActionConfig, size: "large", animation: FadeInUp.delay(FADE_ANIMATION_DURATION) }) })] }))] })) })));
|
|
57
53
|
};
|
|
@@ -2,42 +2,43 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
2
2
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
|
+
import { numToPx } from '@ovotech/element-core';
|
|
5
6
|
import Animated from 'react-native-reanimated';
|
|
6
7
|
import styled, { css } from '../../styled.native';
|
|
7
|
-
|
|
8
|
+
var Z_INDEX = 1000;
|
|
9
|
+
export var NavWrapper = styled(Animated.View)(function (_a) {
|
|
8
10
|
var _b = _a.theme, semantic = _b.semantic, core = _b.core, collapsed = _a.collapsed;
|
|
9
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n
|
|
10
|
-
? css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-bottom-width:
|
|
11
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n position: absolute;\n /* yes, it is not a good move, but we want header to be the topmost element on the screen and we can't control app zIndex */\n z-index: ", ";\n\n background-color: ", ";\n\n ", "\n "], ["\n width: 100%;\n position: absolute;\n /* yes, it is not a good move, but we want header to be the topmost element on the screen and we can't control app zIndex */\n z-index: ", ";\n\n background-color: ", ";\n\n ", "\n "])), Z_INDEX, semantic.surface.base, collapsed
|
|
12
|
+
? css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-bottom-width: ", ";\n border-bottom-style: solid;\n border-bottom-color: ", ";\n "], ["\n border-bottom-width: ", ";\n border-bottom-style: solid;\n border-bottom-color: ", ";\n "])), numToPx(core.borderWidth.small), semantic.border.differentiated) : '');
|
|
13
|
+
});
|
|
14
|
+
export var NavContainer = styled.View(function (_a) {
|
|
15
|
+
var core = _a.theme.core, topOffset = _a.topOffset;
|
|
16
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n /* NavWrapper zIndex + 1 so it is always on top of the wrapper */\n z-index: ", ";\n width: 100%;\n\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n flex-wrap: wrap;\n\n padding: ", " ", ";\n padding-top: ", ";\n "], ["\n position: absolute;\n /* NavWrapper zIndex + 1 so it is always on top of the wrapper */\n z-index: ", ";\n width: 100%;\n\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n flex-wrap: wrap;\n\n padding: ", " ", ";\n padding-top: ", ";\n "])), Z_INDEX + 1, numToPx(core.space[2]), numToPx(core.space[4]), numToPx(topOffset ? topOffset : core.space[2]));
|
|
11
17
|
});
|
|
12
18
|
export var ExpandedTitle = styled(Animated.Text)(function (_a) {
|
|
13
19
|
var _b = _a.theme, core = _b.core, semantic = _b.semantic, hasBackButton = _a.hasBackButton, fullWidth = _a.fullWidth;
|
|
14
|
-
return css(
|
|
15
|
-
? core.lineHeight.heading1.small
|
|
16
|
-
: core.space[13], hasBackButton ? core.lineHeight.heading1.small : core.space[13], semantic.message.branded);
|
|
17
|
-
});
|
|
18
|
-
export var CollapsedTitleWrapper = styled(Animated.View)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n align-items: center;\n justify-content: center;\n width: 33.3%;\n height: ", ";\n"], ["\n align-items: center;\n justify-content: center;\n width: 33.3%;\n height: ", ";\n"])), function (_a) {
|
|
19
|
-
var core = _a.theme.core;
|
|
20
|
-
return core.lineHeight.heading4.small;
|
|
20
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n width: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), fullWidth ? '100%' : '65%', core.fontFamily.heading.native, numToPx(core.fontSize.heading1[hasBackButton ? 'small' : 'large']), numToPx(hasBackButton ? core.lineHeight.heading1.small : core.space[13]), semantic.message.branded);
|
|
21
21
|
});
|
|
22
|
+
export var CollapsedTitleWrapper = styled(Animated.View)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 33.3%;\n align-items: center;\n justify-content: center;\n"], ["\n width: 33.3%;\n align-items: center;\n justify-content: center;\n"])));
|
|
22
23
|
export var CollapsedTitle = styled(Animated.Text)(function (_a) {
|
|
23
24
|
var _b = _a.theme, core = _b.core, semantic = _b.semantic;
|
|
24
|
-
return css(
|
|
25
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), core.fontFamily.heading.native, numToPx(core.fontSize.heading4.small), numToPx(core.lineHeight.heading4.small), semantic.message.branded);
|
|
25
26
|
});
|
|
26
|
-
export var IconButtonWrapper = styled.View(
|
|
27
|
+
export var IconButtonWrapper = styled.View(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n width: 33.3%;\n flex-direction: row;\n justify-content: flex-end;\n"], ["\n width: 33.3%;\n flex-direction: row;\n justify-content: flex-end;\n"])));
|
|
27
28
|
var iconButtonSharedStyles = css(function (_a) {
|
|
28
29
|
var semantic = _a.theme.semantic;
|
|
29
30
|
return "\n border-radius: 100px;\n background-color: ".concat(semantic.inverted.surface, ";\n align-items: center;\n justify-content: center;\n");
|
|
30
31
|
});
|
|
31
|
-
export var StyledIconButtonS = styled(Animated.View)(
|
|
32
|
+
export var StyledIconButtonS = styled(Animated.View)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n width: 28px;\n height: 28px;\n opacity: ", ";\n ", ";\n"], ["\n width: 28px;\n height: 28px;\n opacity: ", ";\n ", ";\n"])), function (_a) {
|
|
32
33
|
var $pressed = _a.$pressed;
|
|
33
34
|
return ($pressed ? 0.8 : 1);
|
|
34
35
|
}, iconButtonSharedStyles);
|
|
35
|
-
export var StyledIconButtonL = styled(Animated.View)(
|
|
36
|
+
export var StyledIconButtonL = styled(Animated.View)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n width: 36px;\n height: 36px;\n opacity: ", ";\n ", ";\n"], ["\n width: 36px;\n height: 36px;\n opacity: ", ";\n ", ";\n"])), function (_a) {
|
|
36
37
|
var $pressed = _a.$pressed;
|
|
37
38
|
return ($pressed ? 0.8 : 1);
|
|
38
39
|
}, iconButtonSharedStyles);
|
|
39
40
|
export var ActionWrapper = styled.View(function (_a) {
|
|
40
41
|
var core = _a.theme.core, collapsed = _a.collapsed;
|
|
41
|
-
return css(
|
|
42
|
+
return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n margin-bottom: ", ";\n "], ["\n margin-bottom: ", ";\n "])), collapsed ? '0' : numToPx(core.space[2]));
|
|
42
43
|
});
|
|
43
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
44
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
@@ -25,51 +25,54 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
27
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
|
+
import { numToPx } from '@ovotech/element-core';
|
|
28
29
|
import { forwardRef, useState } from 'react';
|
|
29
30
|
import { View } from 'react-native';
|
|
30
31
|
import styled, { css } from '../../styled.native';
|
|
31
32
|
import { Icon } from '../Icon';
|
|
32
33
|
var NotificationBox = styled.View(function (_a) {
|
|
33
|
-
var
|
|
34
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n
|
|
34
|
+
var _b = _a.theme, core = _b.core, semantic = _b.semantic, noMargin = _a.noMargin;
|
|
35
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n margin-bottom: ", ";\n border: ", " solid\n ", ";\n border-radius: ", ";\n overflow: hidden;\n "], ["\n position: relative;\n margin-bottom: ", ";\n border: ", " solid\n ", ";\n border-radius: ", ";\n overflow: hidden;\n "])), noMargin ? 0 : numToPx(core.space[4]), numToPx(core.borderWidth.small), semantic.surface.elevated, numToPx(core.radius.max));
|
|
35
36
|
});
|
|
36
37
|
export var NotificationContentBox = styled.View(function (_a) {
|
|
37
|
-
var
|
|
38
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n
|
|
38
|
+
var _b = _a.theme, core = _b.core, semantic = _b.semantic;
|
|
39
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n "], ["\n background-color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n "])), semantic.surface.elevated, numToPx(core.space[2]), numToPx(core.space[3]), numToPx(core.space[4]), numToPx(core.space[4]));
|
|
39
40
|
});
|
|
40
41
|
export var NotificationTitleBox = styled.View(function (_a) {
|
|
41
42
|
var _b = _a.theme, core = _b.core, semantic = _b.semantic, variant = _a.variant, dismissible = _a.dismissible;
|
|
42
43
|
var currentVariant = semantic[variant];
|
|
43
|
-
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n align-items: center;\n background-color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n "], ["\n flex-direction: row;\n align-items: center;\n background-color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n "])), currentVariant.surface, core.space[2], core.space[2], core.space[4], dismissible
|
|
44
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background-color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n min-height: 44px;\n "], ["\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background-color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n min-height: 44px;\n "])), currentVariant.surface, numToPx(core.space[2]), numToPx(core.space[2]), numToPx(core.space[4]), dismissible
|
|
45
|
+
? numToPx(core.space[3])
|
|
46
|
+
: numToPx(core.space[4]));
|
|
44
47
|
});
|
|
45
48
|
var NotificationTitleText = styled.Text(function (_a) {
|
|
46
49
|
var _b = _a.theme, core = _b.core, semantic = _b.semantic, variant = _a.variant;
|
|
47
50
|
var currentVariant = semantic[variant];
|
|
48
|
-
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: ", ";\n font-family: ", ";\n color: ", ";\n "], ["\n font-size: ", ";\n font-family: ", ";\n color: ", ";\n "])), core.fontSize.body.small, core.fontFamily.bodyBold.native, currentVariant.message);
|
|
51
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: ", ";\n font-family: ", ";\n color: ", ";\n "], ["\n font-size: ", ";\n font-family: ", ";\n color: ", ";\n "])), numToPx(core.fontSize.body.small), core.fontFamily.bodyBold.native, currentVariant.message);
|
|
49
52
|
});
|
|
50
|
-
var DismissButton = styled.TouchableOpacity(function () {
|
|
51
|
-
|
|
53
|
+
var DismissButton = styled.TouchableOpacity(function (_a) {
|
|
54
|
+
var _b = _a.theme, core = _b.core, semantic = _b.semantic;
|
|
55
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n align-items: center;\n width: 28px;\n height: 28px;\n background: ", ";\n border: ", " solid\n ", ";\n border-radius: ", ";\n "], ["\n display: flex;\n justify-content: center;\n align-items: center;\n width: 28px;\n height: 28px;\n background: ", ";\n border: ", " solid\n ", ";\n border-radius: ", ";\n "])), semantic.inverted.surface, numToPx(core.borderWidth.small), core.color.brand.forest, numToPx(core.radius.max));
|
|
52
56
|
});
|
|
53
57
|
var StyledIcon = styled(Icon)(function (_a) {
|
|
54
|
-
var semantic = _a.theme.semantic
|
|
55
|
-
|
|
56
|
-
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), currentVariant.message);
|
|
58
|
+
var semantic = _a.theme.semantic;
|
|
59
|
+
return "\n color: ".concat(semantic.inverted.message.base, ";\n ");
|
|
57
60
|
});
|
|
58
61
|
export var Notification = forwardRef(function (_a, ref) {
|
|
59
|
-
var _b = _a.variant, variant = _b === void 0 ? '
|
|
62
|
+
var _b = _a.variant, variant = _b === void 0 ? 'neutral' : _b, children = _a.children, title = _a.title, noMargin = _a.noMargin, dismissible = _a.dismissible, onDismiss = _a.onDismiss, rest = __rest(_a, ["variant", "children", "title", "noMargin", "dismissible", "onDismiss"]);
|
|
60
63
|
var _c = useState(false), dismissed = _c[0], setDismissed = _c[1];
|
|
61
64
|
if (dismissed || (!title && !children)) {
|
|
62
65
|
return null;
|
|
63
66
|
}
|
|
64
|
-
return (_jsx(View, __assign({ ref: ref }, rest, { children: _jsxs(NotificationBox, __assign({ noMargin: noMargin, testID: "nb-notification" }, { children: [_jsxs(NotificationTitleBox, __assign({ variant: variant, dismissible: dismissible }, { children: [_jsx(NotificationTitleText, __assign({ variant: variant }, { children: title })), dismissible ? (_jsx(DismissButton, __assign({ accessibilityLabel: "Dismiss", testID: "nb-notification-dismiss", onPress: function () {
|
|
67
|
+
return (_jsx(View, __assign({ ref: ref }, rest, { children: _jsxs(NotificationBox, __assign({ noMargin: noMargin, testID: "nb-notification" }, { children: [_jsxs(NotificationTitleBox, __assign({ variant: variant, dismissible: dismissible }, { children: [_jsx(NotificationTitleText, __assign({ variant: variant }, { children: title })), dismissible ? (_jsx(DismissButton, __assign({ accessible: true, accessibilityLabel: "Dismiss", testID: "nb-notification-dismiss", onPress: function () {
|
|
65
68
|
setDismissed(true);
|
|
66
69
|
if (onDismiss) {
|
|
67
70
|
onDismiss();
|
|
68
71
|
}
|
|
69
|
-
} }, { children: _jsx(StyledIcon, {
|
|
72
|
+
} }, { children: _jsx(StyledIcon, { name: "cross", size: "16" }) }))) : null] })), children ? (_jsx(NotificationContentBox, __assign({ "data-testid": "el-notification-box" }, { children: children }))) : null] })) })));
|
|
70
73
|
});
|
|
71
74
|
export var ErrorNotification = forwardRef(function (props, ref) { return _jsx(Notification, __assign({ ref: ref, variant: "error" }, props)); });
|
|
72
75
|
export var SuccessNotification = forwardRef(function (props, ref) { return (_jsx(Notification, __assign({ ref: ref, variant: "success" }, props))); });
|
|
73
76
|
export var InfoNotification = forwardRef(function (props, ref) { return _jsx(Notification, __assign({ ref: ref, variant: "info" }, props)); });
|
|
74
77
|
export var WarningNotification = forwardRef(function (props, ref) { return _jsx(Notification, __assign({ ref: ref, variant: "warning" }, props)); });
|
|
75
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5
|
|
78
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|