@ovotech/element-native 3.3.1 → 3.3.2-canary-51af19f-615
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 +2 -2
- package/dist/components/List/List.js +3 -3
- package/dist/components/NavHeader/NavHeader.d.ts +9 -11
- package/dist/components/NavHeader/NavHeader.js +45 -47
- package/dist/components/NavHeader/NavHeader.styles.d.ts +1833 -0
- package/dist/components/NavHeader/NavHeader.styles.js +72 -0
- package/dist/components/SummaryList/SummaryList.d.ts +14 -0
- package/dist/components/SummaryList/SummaryList.js +47 -0
- package/dist/components/SummaryList/index.d.ts +1 -0
- package/dist/components/SummaryList/index.js +6 -0
- package/dist/esm/components/Accordion/Accordion.js +1 -1
- package/dist/esm/components/List/List.js +3 -3
- package/dist/esm/components/NavHeader/NavHeader.js +48 -50
- package/dist/esm/components/NavHeader/NavHeader.styles.js +43 -0
- package/dist/esm/components/SummaryList/SummaryList.js +43 -0
- package/dist/esm/components/SummaryList/index.js +1 -0
- package/dist/esm/hooks/use-layout.js +16 -0
- package/dist/esm/theme/create-theme.js +330 -0
- package/dist/esm/theme/index.js +19 -0
- package/dist/esm/theme/theme.js +1 -0
- package/dist/hooks/use-layout.d.ts +6 -0
- package/dist/hooks/use-layout.js +20 -0
- package/dist/providers/types.d.ts +1 -1
- package/dist/theme/create-theme.d.ts +18 -0
- package/dist/theme/create-theme.js +337 -0
- package/dist/theme/index.d.ts +231 -0
- package/dist/theme/index.js +37 -0
- package/dist/theme/theme.d.ts +193 -0
- package/dist/theme/theme.js +2 -0
- package/package.json +3 -2
|
@@ -0,0 +1,72 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
|
+
if (mod && mod.__esModule) return mod;
|
|
24
|
+
var result = {};
|
|
25
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
+
__setModuleDefault(result, mod);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.StyledIconButtonL = exports.StyledIconButtonS = exports.IconButtonWrapper = exports.CollapsedTitle = exports.CollapsedTitleWrapper = exports.ExpandedTitle = exports.NavWrapper = exports.NavContainer = void 0;
|
|
34
|
+
var react_native_reanimated_1 = __importDefault(require("react-native-reanimated"));
|
|
35
|
+
var styled_native_1 = __importStar(require("../../styled.native"));
|
|
36
|
+
var react_native_1 = require("react-native");
|
|
37
|
+
exports.NavContainer = (0, styled_native_1.default)(react_native_reanimated_1.default.View)(function (_a) {
|
|
38
|
+
var semantic = _a.theme.semantic;
|
|
39
|
+
return (0, styled_native_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n background-color: ", ";\n "], ["\n width: 100%;\n background-color: ", ";\n "])), semantic.surface.base);
|
|
40
|
+
});
|
|
41
|
+
exports.NavWrapper = (0, styled_native_1.default)(react_native_1.View)(function (_a) {
|
|
42
|
+
var core = _a.theme.core;
|
|
43
|
+
return (0, styled_native_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n padding: ", ";\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n flex-wrap: wrap;\n "], ["\n width: 100%;\n padding: ", ";\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n flex-wrap: wrap;\n "])), core.space[2]);
|
|
44
|
+
});
|
|
45
|
+
exports.ExpandedTitle = (0, styled_native_1.default)(react_native_reanimated_1.default.Text)(function (_a) {
|
|
46
|
+
var _b = _a.theme, core = _b.core, semantic = _b.semantic, hasBackButton = _a.hasBackButton, fullWidth = _a.fullWidth;
|
|
47
|
+
return (0, styled_native_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n height: ", ";\n color: ", ";\n "], ["\n width: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n height: ", ";\n color: ", ";\n "])), fullWidth ? '100%' : '65%', core.fontFamily.heading.native, core.fontSize.heading1[hasBackButton ? 'small' : 'large'], hasBackButton
|
|
48
|
+
? core.lineHeight.heading1.small
|
|
49
|
+
: core.space[13], hasBackButton ? core.lineHeight.heading1.small : core.space[13], semantic.message.branded);
|
|
50
|
+
});
|
|
51
|
+
exports.CollapsedTitleWrapper = (0, styled_native_1.default)(react_native_reanimated_1.default.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) {
|
|
52
|
+
var core = _a.theme.core;
|
|
53
|
+
return core.lineHeight.heading4.small;
|
|
54
|
+
});
|
|
55
|
+
exports.CollapsedTitle = (0, styled_native_1.default)(react_native_reanimated_1.default.Text)(function (_a) {
|
|
56
|
+
var _b = _a.theme, core = _b.core, semantic = _b.semantic;
|
|
57
|
+
return (0, styled_native_1.css)(templateObject_5 || (templateObject_5 = __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, core.fontSize.heading4.small, core.lineHeight.heading4.small, semantic.message.branded);
|
|
58
|
+
});
|
|
59
|
+
exports.IconButtonWrapper = styled_native_1.default.View(templateObject_6 || (templateObject_6 = __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"])));
|
|
60
|
+
var iconButtonSharedStyles = (0, styled_native_1.css)(function (_a) {
|
|
61
|
+
var semantic = _a.theme.semantic;
|
|
62
|
+
return "\n border-radius: 100px;\n background-color: ".concat(semantic.inverted.surface, ";\n align-items: center;\n justify-content: center;\n");
|
|
63
|
+
});
|
|
64
|
+
exports.StyledIconButtonS = (0, styled_native_1.default)(react_native_reanimated_1.default.View)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n width: 28px;\n height: 28px;\n opacity: ", ";\n ", ";\n"], ["\n width: 28px;\n height: 28px;\n opacity: ", ";\n ", ";\n"])), function (_a) {
|
|
65
|
+
var $pressed = _a.$pressed;
|
|
66
|
+
return ($pressed ? 0.8 : 1);
|
|
67
|
+
}, iconButtonSharedStyles);
|
|
68
|
+
exports.StyledIconButtonL = (0, styled_native_1.default)(react_native_reanimated_1.default.View)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n width: 36px;\n height: 36px;\n opacity: ", ";\n ", ";\n"], ["\n width: 36px;\n height: 36px;\n opacity: ", ";\n ", ";\n"])), function (_a) {
|
|
69
|
+
var $pressed = _a.$pressed;
|
|
70
|
+
return ($pressed ? 0.8 : 1);
|
|
71
|
+
}, iconButtonSharedStyles);
|
|
72
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { Dd, Dl } from '../List';
|
|
3
|
+
declare type SummaryListProps = ComponentProps<typeof Dl>;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated This component has been deprecated and will be removed in a future release.
|
|
6
|
+
* Please use the Description List (List/Dl) component instead.
|
|
7
|
+
* */
|
|
8
|
+
declare const SummaryList: ({ children, ...rest }: SummaryListProps) => JSX.Element;
|
|
9
|
+
declare type SummaryItemProps = ComponentProps<typeof Dd> & {
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
index?: number;
|
|
12
|
+
};
|
|
13
|
+
declare const SummaryItem: ({ label, children, index, ...rest }: SummaryItemProps) => JSX.Element;
|
|
14
|
+
export { SummaryList, SummaryItem };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.SummaryItem = exports.SummaryList = void 0;
|
|
26
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
+
var react_1 = require("react");
|
|
28
|
+
var List_1 = require("../List");
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated This component has been deprecated and will be removed in a future release.
|
|
31
|
+
* Please use the Description List (List/Dl) component instead.
|
|
32
|
+
* */
|
|
33
|
+
var SummaryList = function (_a) {
|
|
34
|
+
var children = _a.children, rest = __rest(_a, ["children"]);
|
|
35
|
+
console.warn('SummaryList component has been deprecated and will be removed in a future release. Please use the DescriptionList component instead.');
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(List_1.Dl, __assign({}, rest, { children: react_1.Children.map(children, function (child, index) {
|
|
37
|
+
return (0, react_1.cloneElement)(child, {
|
|
38
|
+
index: index,
|
|
39
|
+
});
|
|
40
|
+
}) })));
|
|
41
|
+
};
|
|
42
|
+
exports.SummaryList = SummaryList;
|
|
43
|
+
var SummaryItem = function (_a) {
|
|
44
|
+
var label = _a.label, children = _a.children, index = _a.index, rest = __rest(_a, ["label", "children", "index"]);
|
|
45
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(List_1.Dt, __assign({ style: index === 0 ? { marginTop: 0 } : undefined }, { children: label })), (0, jsx_runtime_1.jsx)(List_1.Dd, __assign({}, rest, { children: children }))] }));
|
|
46
|
+
};
|
|
47
|
+
exports.SummaryItem = SummaryItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SummaryList, SummaryItem } from './SummaryList';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SummaryItem = exports.SummaryList = void 0;
|
|
4
|
+
var SummaryList_1 = require("./SummaryList");
|
|
5
|
+
Object.defineProperty(exports, "SummaryList", { enumerable: true, get: function () { return SummaryList_1.SummaryList; } });
|
|
6
|
+
Object.defineProperty(exports, "SummaryItem", { enumerable: true, get: function () { return SummaryList_1.SummaryItem; } });
|
|
@@ -27,12 +27,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
27
27
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
28
|
import { Component, useCallback, useContext, useEffect, useMemo, useState, } from 'react';
|
|
29
29
|
import Animated, { interpolateColor, runOnUI, useAnimatedStyle, useDerivedValue, useSharedValue, withTiming, } from 'react-native-reanimated';
|
|
30
|
+
import { useLayout } from '../../hooks/use-layout';
|
|
30
31
|
import { ThemeContext } from '../../styled.native';
|
|
31
32
|
import { pxToNumber } from '../../utils';
|
|
32
33
|
import { Heading4 } from '../Heading';
|
|
33
34
|
import { AccordionGroupContext } from './Group';
|
|
34
35
|
import { AccordionIcon } from './Icon';
|
|
35
|
-
import { useLayout } from './hooks';
|
|
36
36
|
import { StyledAccordion, StyledAccordionHeader, StyledContainer, } from './styles';
|
|
37
37
|
export function withAnimated(WrappedComponent) {
|
|
38
38
|
var displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
@@ -71,14 +71,14 @@ var Ul = function (_a) {
|
|
|
71
71
|
var renderList = function (arrayChildren, level) {
|
|
72
72
|
if (level === void 0) { level = 0; }
|
|
73
73
|
return Children.map(arrayChildren, function (child) {
|
|
74
|
-
var _a, _b;
|
|
74
|
+
var _a, _b, _c;
|
|
75
75
|
// @ts-ignore It complains that child props doesn't exist. Weird.
|
|
76
|
-
if (Array.isArray((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.children)) {
|
|
76
|
+
if (Array.isArray((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.children) && ((_b = child === null || child === void 0 ? void 0 : child.type) === null || _b === void 0 ? void 0 : _b.name) === 'Ul') {
|
|
77
77
|
var lvl = level;
|
|
78
78
|
var PADDING = 3;
|
|
79
79
|
lvl = lvl + PADDING;
|
|
80
80
|
// @ts-ignore It complains that child props doesn't exist. Weird.
|
|
81
|
-
return renderList((
|
|
81
|
+
return renderList((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.children, lvl);
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
84
84
|
return (_jsx(ListBulletItem, __assign({ showBullets: showBullets, level: level }, { children: child })));
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
1
|
var __assign = (this && this.__assign) || function () {
|
|
6
2
|
__assign = Object.assign || function(t) {
|
|
7
3
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -13,51 +9,53 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
9
|
};
|
|
14
10
|
return __assign.apply(this, arguments);
|
|
15
11
|
};
|
|
16
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
var LeftHeaderText = styled(StyledText)(function (_a) {
|
|
30
|
-
var core = _a.theme.core;
|
|
31
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-left: ", ";\n "], ["\n padding-left: ", ";\n "])), core.space[2]);
|
|
32
|
-
});
|
|
33
|
-
var HeadlineView = styled(Animated.View)(function (_a) {
|
|
34
|
-
var core = _a.theme.core;
|
|
35
|
-
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: 0 ", " ", ";\n "], ["\n padding: 0 ", " ", ";\n "])), core.space[3], core.space[3]);
|
|
36
|
-
});
|
|
37
|
-
var RootView = styled.View(function (_a) {
|
|
38
|
-
var semantic = _a.theme.semantic;
|
|
39
|
-
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n background-color: ", ";\n overflow: hidden;\n "], ["\n background-color: ", ";\n overflow: hidden;\n "])), semantic.message.branded);
|
|
40
|
-
});
|
|
41
|
-
var StyledView = styled(Animated.View)(function (_a) {
|
|
42
|
-
var core = _a.theme.core, marginTop = _a.marginTop;
|
|
43
|
-
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding: ", ";\n padding-bottom: ", ";\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n margin-top: ", ";\n "], ["\n padding: ", ";\n padding-bottom: ", ";\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n margin-top: ", ";\n "])), core.space[3], core.space[2], marginTop !== null && marginTop !== void 0 ? marginTop : 0);
|
|
44
|
-
});
|
|
45
|
-
var StyledHeading4 = styled(Heading4)(function (_a) {
|
|
46
|
-
var _b = _a.theme, core = _b.core, semantic = _b.semantic, textAlign = _a.textAlign;
|
|
47
|
-
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-family: ", ";\n margin-top: 0;\n margin-bottom: 0;\n color: ", ";\n text-align: ", ";\n "], ["\n font-family: ", ";\n margin-top: 0;\n margin-bottom: 0;\n color: ", ";\n text-align: ", ";\n "])), core.fontFamily.bodyBold.native, semantic.inverted.message.base, textAlign);
|
|
48
|
-
});
|
|
49
|
-
var StyledHeading3 = styled(Heading3)(function (_a) {
|
|
50
|
-
var semantic = _a.theme.semantic;
|
|
51
|
-
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-top: 0;\n margin-bottom: 0;\n padding-top: 0;\n color: ", ";\n text-align: left;\n "], ["\n margin-top: 0;\n margin-bottom: 0;\n padding-top: 0;\n color: ", ";\n text-align: left;\n "])), semantic.inverted.message.base);
|
|
52
|
-
});
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { theme } from '@ovotech/element-core';
|
|
14
|
+
import { useEffect } from 'react';
|
|
15
|
+
import { Pressable } from 'react-native';
|
|
16
|
+
import Animated, { FadeInDown, FadeInUp, FadeOutDown, FadeOutUp, Layout, runOnUI, useAnimatedStyle, useSharedValue, withTiming, } from 'react-native-reanimated';
|
|
17
|
+
import { useLayout } from '../../hooks/use-layout';
|
|
18
|
+
import { Action } from '../ActionList';
|
|
19
|
+
import { Icon } from '../Icon';
|
|
20
|
+
import { CollapsedTitleWrapper, ExpandedTitle, IconButtonWrapper, NavContainer, StyledIconButtonL, StyledIconButtonS, CollapsedTitle, NavWrapper, } from './NavHeader.styles';
|
|
21
|
+
// calculated based on layout with maximum possible height
|
|
22
|
+
var INITIAL_HEADER_HEIGHT = 115;
|
|
23
|
+
var FADE_ANIMATION_DURATION = 250; // ms
|
|
53
24
|
export var NavHeader = function (_a) {
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
25
|
+
var title = _a.title, scrolled = _a.scrolled, rightActionConfig = _a.rightActionConfig, canGoBack = _a.canGoBack, goBack = _a.goBack;
|
|
26
|
+
var _b = useLayout(INITIAL_HEADER_HEIGHT), layout = _b[0], onLayout = _b[1];
|
|
27
|
+
var navHeight = useSharedValue(layout.height); // initial value
|
|
28
|
+
var animatedNavHeight = useAnimatedStyle(function () {
|
|
29
|
+
return {
|
|
30
|
+
height: navHeight.value,
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
// take children calculated height and change NavContainer height accordingly but with animation
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
runOnUI(function () {
|
|
36
|
+
'worklet';
|
|
37
|
+
navHeight.value = withTiming(Math.floor(layout.height), {
|
|
38
|
+
duration: FADE_ANIMATION_DURATION,
|
|
39
|
+
});
|
|
40
|
+
})();
|
|
41
|
+
}, [layout.height]);
|
|
42
|
+
// NavContainer is animated view, height transition will be smooth
|
|
43
|
+
// in order to tell NavContainer which height it children have we need another NavWrapper
|
|
44
|
+
// back-button, title and right-action has wrappers with 33.3% and they are always rendered
|
|
45
|
+
// we need it for correct placing of the title when either back-button or right-action missing
|
|
46
|
+
return (_jsx(NavContainer, __assign({ style: animatedNavHeight }, { children: _jsxs(NavWrapper, __assign({ onLayout: onLayout }, { children: [_jsx(Animated.View, __assign({ style: {
|
|
47
|
+
width: scrolled ? '33.3%' : '100%',
|
|
48
|
+
height: !canGoBack ? parseInt(theme.core.space[10]) : undefined,
|
|
49
|
+
}, layout: Layout.delay(FADE_ANIMATION_DURATION) }, { children: canGoBack && (_jsx(Action, __assign({ actionType: "back", onPress: goBack }, { children: "Back" }))) })), 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, __assign({ fullWidth: !scrolled && !rightActionConfig, numberOfLines: 1, 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) }) })] }))] })) })));
|
|
50
|
+
};
|
|
51
|
+
var IconButton = function (_a) {
|
|
52
|
+
var size = _a.size, animation = _a.animation, rightActionConfig = _a.rightActionConfig;
|
|
53
|
+
var ButtonStyled = size === 'small' ? StyledIconButtonS : StyledIconButtonL;
|
|
54
|
+
if (!rightActionConfig || !(rightActionConfig === null || rightActionConfig === void 0 ? void 0 : rightActionConfig.iconName)) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return (_jsx(Pressable, __assign({ hitSlop: 44, pressRetentionOffset: 44, onPress: rightActionConfig === null || rightActionConfig === void 0 ? void 0 : rightActionConfig.onActionPress }, { children: function (_a) {
|
|
58
|
+
var pressed = _a.pressed;
|
|
59
|
+
return (_jsx(ButtonStyled, __assign({ entering: animation, "$pressed": pressed }, { children: _jsx(Icon, { name: rightActionConfig.iconName, size: size === 'small' ? 16 : 18, color: theme.semantic.inverted.message.base }) })));
|
|
60
|
+
} })));
|
|
62
61
|
};
|
|
63
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import Animated from 'react-native-reanimated';
|
|
6
|
+
import styled, { css } from '../../styled.native';
|
|
7
|
+
import { View } from 'react-native';
|
|
8
|
+
export var NavContainer = styled(Animated.View)(function (_a) {
|
|
9
|
+
var semantic = _a.theme.semantic;
|
|
10
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n background-color: ", ";\n "], ["\n width: 100%;\n background-color: ", ";\n "])), semantic.surface.base);
|
|
11
|
+
});
|
|
12
|
+
export var NavWrapper = styled(View)(function (_a) {
|
|
13
|
+
var core = _a.theme.core;
|
|
14
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n padding: ", ";\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n flex-wrap: wrap;\n "], ["\n width: 100%;\n padding: ", ";\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n flex-wrap: wrap;\n "])), core.space[2]);
|
|
15
|
+
});
|
|
16
|
+
export var ExpandedTitle = styled(Animated.Text)(function (_a) {
|
|
17
|
+
var _b = _a.theme, core = _b.core, semantic = _b.semantic, hasBackButton = _a.hasBackButton, fullWidth = _a.fullWidth;
|
|
18
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n height: ", ";\n color: ", ";\n "], ["\n width: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n height: ", ";\n color: ", ";\n "])), fullWidth ? '100%' : '65%', core.fontFamily.heading.native, core.fontSize.heading1[hasBackButton ? 'small' : 'large'], hasBackButton
|
|
19
|
+
? core.lineHeight.heading1.small
|
|
20
|
+
: core.space[13], hasBackButton ? core.lineHeight.heading1.small : core.space[13], semantic.message.branded);
|
|
21
|
+
});
|
|
22
|
+
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) {
|
|
23
|
+
var core = _a.theme.core;
|
|
24
|
+
return core.lineHeight.heading4.small;
|
|
25
|
+
});
|
|
26
|
+
export var CollapsedTitle = styled(Animated.Text)(function (_a) {
|
|
27
|
+
var _b = _a.theme, core = _b.core, semantic = _b.semantic;
|
|
28
|
+
return css(templateObject_5 || (templateObject_5 = __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, core.fontSize.heading4.small, core.lineHeight.heading4.small, semantic.message.branded);
|
|
29
|
+
});
|
|
30
|
+
export var IconButtonWrapper = styled.View(templateObject_6 || (templateObject_6 = __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"])));
|
|
31
|
+
var iconButtonSharedStyles = css(function (_a) {
|
|
32
|
+
var semantic = _a.theme.semantic;
|
|
33
|
+
return "\n border-radius: 100px;\n background-color: ".concat(semantic.inverted.surface, ";\n align-items: center;\n justify-content: center;\n");
|
|
34
|
+
});
|
|
35
|
+
export var StyledIconButtonS = styled(Animated.View)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n width: 28px;\n height: 28px;\n opacity: ", ";\n ", ";\n"], ["\n width: 28px;\n height: 28px;\n opacity: ", ";\n ", ";\n"])), function (_a) {
|
|
36
|
+
var $pressed = _a.$pressed;
|
|
37
|
+
return ($pressed ? 0.8 : 1);
|
|
38
|
+
}, iconButtonSharedStyles);
|
|
39
|
+
export var StyledIconButtonL = styled(Animated.View)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n width: 36px;\n height: 36px;\n opacity: ", ";\n ", ";\n"], ["\n width: 36px;\n height: 36px;\n opacity: ", ";\n ", ";\n"])), function (_a) {
|
|
40
|
+
var $pressed = _a.$pressed;
|
|
41
|
+
return ($pressed ? 0.8 : 1);
|
|
42
|
+
}, iconButtonSharedStyles);
|
|
43
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import { Children, cloneElement } from 'react';
|
|
25
|
+
import { Dd, Dl, Dt } from '../List';
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated This component has been deprecated and will be removed in a future release.
|
|
28
|
+
* Please use the Description List (List/Dl) component instead.
|
|
29
|
+
* */
|
|
30
|
+
var SummaryList = function (_a) {
|
|
31
|
+
var children = _a.children, rest = __rest(_a, ["children"]);
|
|
32
|
+
console.warn('SummaryList component has been deprecated and will be removed in a future release. Please use the DescriptionList component instead.');
|
|
33
|
+
return (_jsx(Dl, __assign({}, rest, { children: Children.map(children, function (child, index) {
|
|
34
|
+
return cloneElement(child, {
|
|
35
|
+
index: index,
|
|
36
|
+
});
|
|
37
|
+
}) })));
|
|
38
|
+
};
|
|
39
|
+
var SummaryItem = function (_a) {
|
|
40
|
+
var label = _a.label, children = _a.children, index = _a.index, rest = __rest(_a, ["label", "children", "index"]);
|
|
41
|
+
return (_jsxs(_Fragment, { children: [_jsx(Dt, __assign({ style: index === 0 ? { marginTop: 0 } : undefined }, { children: label })), _jsx(Dd, __assign({}, rest, { children: children }))] }));
|
|
42
|
+
};
|
|
43
|
+
export { SummaryList, SummaryItem };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SummaryList, SummaryItem } from './SummaryList';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
export var useLayout = function (defaultHeight) {
|
|
3
|
+
var _a = useState({ height: defaultHeight || 0, width: 0, measured: false }), layout = _a[0], setLayout = _a[1];
|
|
4
|
+
var onLayout = useCallback(function (e) {
|
|
5
|
+
var _a = e.nativeEvent.layout, height = _a.height, width = _a.width;
|
|
6
|
+
if (height === layout.height && width === layout.width) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
setLayout({
|
|
10
|
+
height: height,
|
|
11
|
+
width: width,
|
|
12
|
+
measured: true,
|
|
13
|
+
});
|
|
14
|
+
}, [layout.height, layout.width]);
|
|
15
|
+
return [layout, onLayout];
|
|
16
|
+
};
|