@ovotech/element-native 3.0.0 → 3.1.0-canary-394fb2a-106
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.d.ts +1 -1
- package/dist/components/Accordion/Accordion.js +9 -6
- package/dist/components/Accordion/Group.d.ts +4 -1
- package/dist/components/Accordion/Group.js +24 -10
- package/dist/components/Accordion/styles.d.ts +3 -3
- package/dist/components/Accordion/types.d.ts +3 -3
- package/dist/components/ActionList/ActionList.d.ts +22 -0
- package/dist/components/ActionList/ActionList.js +60 -0
- package/dist/components/ActionList/index.d.ts +1 -0
- package/dist/components/ActionList/index.js +17 -0
- package/dist/components/ActionList/styled.d.ts +1155 -0
- package/dist/components/ActionList/styled.js +57 -0
- package/dist/components/Badge/Badge.d.ts +1 -1
- package/dist/components/CTAButton/CTAButton.d.ts +3 -3
- package/dist/components/CTALink/CTALink.d.ts +3 -3
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/DataTable/styles.d.ts +11 -11
- package/dist/components/DescriptionList/styled.d.ts +1 -1
- package/dist/components/Divider/Divider.js +3 -1
- package/dist/components/ErrorText/ErrorText.d.ts +1 -1
- package/dist/components/FormGroup/FormGroup.js +1 -0
- package/dist/components/Grid/Col.d.ts +1 -1
- package/dist/components/Grid/Row.d.ts +1 -1
- package/dist/components/HintText/HintText.d.ts +1 -1
- package/dist/components/Icon/Icon.d.ts +2 -2
- package/dist/components/Input/CurrencyInput.d.ts +2 -2
- package/dist/components/Input/EmailInput.d.ts +2 -2
- package/dist/components/Input/Input.d.ts +5 -5
- package/dist/components/Input/NumberInput.d.ts +2 -2
- package/dist/components/Input/PasswordInput.d.ts +2 -2
- package/dist/components/Input/PasswordInput.styled.d.ts +1 -1
- package/dist/components/Input/PasswordVisibilityToggle.d.ts +2 -1
- package/dist/components/Input/PhoneInput.d.ts +2 -2
- package/dist/components/Input/TextInput.d.ts +2 -2
- package/dist/components/Input/TextareaInput.d.ts +2 -2
- package/dist/components/LabelText/LabelText.d.ts +1 -1
- package/dist/components/List/List.d.ts +3 -3
- package/dist/components/Margin/Margin.d.ts +4 -1
- package/dist/components/Notification/Notification.d.ts +2 -2
- package/dist/components/Radio/Radio.js +2 -2
- package/dist/components/SelectField/Select.d.ts +2 -1
- package/dist/components/SelectField/Select.js +15 -14
- package/dist/components/SkeletonLoading/Skeleton.d.ts +1 -1
- package/dist/components/SubLabelText/SubLabelText.d.ts +1 -1
- package/dist/components/Text/Text.d.ts +5 -5
- package/dist/components/TextField/CurrencyField.d.ts +2 -2
- package/dist/components/TextField/EmailField.d.ts +2 -2
- package/dist/components/TextField/NumberField.d.ts +2 -2
- package/dist/components/TextField/PasswordField.d.ts +2 -2
- package/dist/components/TextField/PhoneField.d.ts +2 -2
- package/dist/components/TextField/TelField.d.ts +2 -2
- package/dist/components/TextField/TextField.d.ts +2 -2
- package/dist/components/TextField/TextareaField.d.ts +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/esm/components/Accordion/Accordion.js +9 -6
- package/dist/esm/components/Accordion/Group.js +24 -10
- package/dist/esm/components/ActionList/ActionList.js +56 -0
- package/dist/esm/components/ActionList/index.js +1 -0
- package/dist/esm/components/ActionList/styled.js +31 -0
- package/dist/esm/components/Divider/Divider.js +3 -1
- package/dist/esm/components/FormGroup/FormGroup.js +1 -0
- package/dist/esm/components/Radio/Radio.js +2 -2
- package/dist/esm/components/SelectField/Select.js +14 -16
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/utils/utils.js +1 -0
- package/dist/providers/IconsProvider.d.ts +1 -1
- package/dist/providers/types.d.ts +1 -0
- package/dist/styled.native.d.ts +6 -6
- package/dist/theme/create-theme.d.ts +1 -1
- package/dist/theme/index.d.ts +1 -1
- package/dist/utils/utils.js +1 -0
- package/package.json +5 -3
- package/dist/components/Input/TelInput.d.ts +0 -10
- package/dist/components/Input/TelInput.js +0 -41
- package/dist/esm/components/Input/TelInput.js +0 -15
- package/dist/esm/providers/icons/HidePassword.js +0 -15
- package/dist/esm/providers/icons/Payment.js +0 -15
- package/dist/esm/providers/icons/ShowPassword.js +0 -15
- package/dist/esm/providers/icons/Usage.js +0 -15
- package/dist/providers/icons/HidePassword.d.ts +0 -2
- package/dist/providers/icons/HidePassword.js +0 -22
- package/dist/providers/icons/Payment.d.ts +0 -2
- package/dist/providers/icons/Payment.js +0 -22
- package/dist/providers/icons/ShowPassword.d.ts +0 -2
- package/dist/providers/icons/ShowPassword.js +0 -22
- package/dist/providers/icons/Usage.d.ts +0 -2
- package/dist/providers/icons/Usage.js +0 -22
|
@@ -2,4 +2,4 @@ import { ComponentClass, ComponentType } from 'react';
|
|
|
2
2
|
import { AnimateProps } from 'react-native-reanimated';
|
|
3
3
|
import { AccordionProps } from './types';
|
|
4
4
|
export declare function withAnimated<T extends object>(WrappedComponent: ComponentType<T>): ComponentClass<AnimateProps<T>>;
|
|
5
|
-
export declare const Accordion: ({ expanded, first,
|
|
5
|
+
export declare const Accordion: ({ expanded, first, last, title, children, onToggle, }: AccordionProps) => JSX.Element;
|
|
@@ -56,6 +56,7 @@ var react_native_reanimated_1 = __importStar(require("react-native-reanimated"))
|
|
|
56
56
|
var styled_native_1 = require("../../styled.native");
|
|
57
57
|
var utils_1 = require("../../utils");
|
|
58
58
|
var Heading_1 = require("../Heading");
|
|
59
|
+
var Group_1 = require("./Group");
|
|
59
60
|
var Icon_1 = require("./Icon");
|
|
60
61
|
var hooks_1 = require("./hooks");
|
|
61
62
|
var styles_1 = require("./styles");
|
|
@@ -77,13 +78,15 @@ function withAnimated(WrappedComponent) {
|
|
|
77
78
|
}
|
|
78
79
|
exports.withAnimated = withAnimated;
|
|
79
80
|
var Accordion = function (_a) {
|
|
80
|
-
var _b = _a.expanded, expanded = _b === void 0 ? false : _b, first = _a.first,
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
|
|
81
|
+
var _b = _a.expanded, expanded = _b === void 0 ? false : _b, first = _a.first, last = _a.last, title = _a.title, children = _a.children, onToggle = _a.onToggle;
|
|
82
|
+
var _c = (0, react_1.useContext)(styled_native_1.ThemeContext), core = _c.core, semantic = _c.semantic;
|
|
83
|
+
var Header = (0, react_1.useContext)(Group_1.AccordionGroupContext).Header;
|
|
84
|
+
var AccordionHeading = Header !== null && Header !== void 0 ? Header : Heading_1.Heading4;
|
|
85
|
+
var AnimatedHeading = (0, react_1.useMemo)(function () { return withAnimated(AccordionHeading); }, [
|
|
86
|
+
AccordionHeading,
|
|
84
87
|
]);
|
|
85
|
-
var
|
|
86
|
-
var
|
|
88
|
+
var _d = (0, hooks_1.useLayout)(0), layout = _d[0], onLayout = _d[1];
|
|
89
|
+
var _e = (0, react_1.useState)(expanded), open = _e[0], setOpen = _e[1];
|
|
87
90
|
var handleHeightContent = (0, react_1.useMemo)(function () { return layout.height || 100; }, [
|
|
88
91
|
layout.height,
|
|
89
92
|
]);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { AccordionGroupProps } from './types';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const AccordionGroupContext: import("react").Context<{
|
|
4
|
+
Header?: AccordionGroupProps['headingComponent'];
|
|
5
|
+
}>;
|
|
6
|
+
export declare const AccordionGroup: ({ children, headingComponent, }: PropsWithChildren<AccordionGroupProps>) => JSX.Element;
|
|
@@ -1,19 +1,33 @@
|
|
|
1
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
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AccordionGroup = void 0;
|
|
14
|
+
exports.AccordionGroup = exports.AccordionGroupContext = void 0;
|
|
4
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
16
|
var react_1 = require("react");
|
|
6
17
|
var react_native_1 = require("react-native");
|
|
18
|
+
exports.AccordionGroupContext = (0, react_1.createContext)({
|
|
19
|
+
Header: undefined,
|
|
20
|
+
});
|
|
7
21
|
var AccordionGroup = function (_a) {
|
|
8
|
-
var children = _a.children;
|
|
22
|
+
var children = _a.children, headingComponent = _a.headingComponent;
|
|
9
23
|
var childCount = react_1.Children.count(children);
|
|
10
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { children: react_1.Children.map(children, function (child, i) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(exports.AccordionGroupContext.Provider, __assign({ value: { Header: headingComponent } }, { children: (0, jsx_runtime_1.jsx)(react_native_1.View, { children: react_1.Children.map(children, function (child, i) {
|
|
25
|
+
return (0, react_1.isValidElement)(child)
|
|
26
|
+
? (0, react_1.cloneElement)(child, {
|
|
27
|
+
first: i === 0,
|
|
28
|
+
last: i === childCount - 1,
|
|
29
|
+
})
|
|
30
|
+
: child;
|
|
31
|
+
}) }) })));
|
|
18
32
|
};
|
|
19
33
|
exports.AccordionGroup = AccordionGroup;
|
|
@@ -226,7 +226,7 @@ export declare const StyledAccordion: import("styled-components").StyledComponen
|
|
|
226
226
|
};
|
|
227
227
|
};
|
|
228
228
|
};
|
|
229
|
-
}, {
|
|
229
|
+
} & object, {
|
|
230
230
|
first?: boolean | undefined;
|
|
231
231
|
last?: boolean | undefined;
|
|
232
232
|
}, never>;
|
|
@@ -457,7 +457,7 @@ export declare const StyledAccordionHeader: import("styled-components").StyledCo
|
|
|
457
457
|
};
|
|
458
458
|
};
|
|
459
459
|
};
|
|
460
|
-
}, {}, never>;
|
|
460
|
+
} & object, {}, never>;
|
|
461
461
|
export declare const StyledContainer: import("styled-components").StyledComponent<typeof import("react-native").View, import("../../theme/theme").Theme & {
|
|
462
462
|
core: {
|
|
463
463
|
radius: Record<"small" | "medium" | "large" | "max", string>;
|
|
@@ -685,4 +685,4 @@ export declare const StyledContainer: import("styled-components").StyledComponen
|
|
|
685
685
|
};
|
|
686
686
|
};
|
|
687
687
|
};
|
|
688
|
-
}, {}, never>;
|
|
688
|
+
} & object, {}, never>;
|
|
@@ -5,17 +5,17 @@ export declare type AccordionProps = PropsWithChildren<{
|
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
onToggle?: CallableFunction;
|
|
7
7
|
/**
|
|
8
|
-
* @deprecated
|
|
8
|
+
* @deprecated inline prop is no longer affects styling
|
|
9
9
|
*/
|
|
10
10
|
inline?: boolean;
|
|
11
|
-
headingComponent?: React.ComponentType<any>;
|
|
12
11
|
first?: boolean;
|
|
13
12
|
last?: boolean;
|
|
14
13
|
testId?: string;
|
|
15
14
|
}>;
|
|
16
15
|
export declare type AccordionGroupProps = {
|
|
17
16
|
/**
|
|
18
|
-
* @deprecated
|
|
17
|
+
* @deprecated inline prop is no longer affects styling
|
|
19
18
|
*/
|
|
20
19
|
inline?: boolean;
|
|
20
|
+
headingComponent?: React.ComponentType<any>;
|
|
21
21
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentProps, PropsWithChildren, Ref } from 'react';
|
|
2
|
+
import { AccessibilityRole, View, ViewProps } from 'react-native';
|
|
3
|
+
import { IconName } from '../../providers';
|
|
4
|
+
import { StyledActionList } from './styled';
|
|
5
|
+
declare const ACTION_TYPES: {
|
|
6
|
+
[key: string]: IconName;
|
|
7
|
+
};
|
|
8
|
+
declare type ActionListProps = ComponentProps<typeof StyledActionList>;
|
|
9
|
+
declare type ActionProps = PropsWithChildren<ViewProps & {
|
|
10
|
+
accessibilityRole?: AccessibilityRole;
|
|
11
|
+
actionType?: keyof typeof ACTION_TYPES;
|
|
12
|
+
iconLeft?: IconName | 'off';
|
|
13
|
+
iconRight?: IconName | 'off';
|
|
14
|
+
inverted?: boolean;
|
|
15
|
+
onPress?: () => void;
|
|
16
|
+
fullWidth?: 'always' | 'never' | 'small';
|
|
17
|
+
ref?: Ref<View>;
|
|
18
|
+
testID?: string;
|
|
19
|
+
}>;
|
|
20
|
+
declare const ActionList: ({ children, inverted, ...rest }: ActionListProps) => JSX.Element;
|
|
21
|
+
declare const Action: ({ accessibilityRole, actionType, children, inverted, onPress, testID, ...rest }: ActionProps) => JSX.Element;
|
|
22
|
+
export { ActionList, Action };
|
|
@@ -0,0 +1,60 @@
|
|
|
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.Action = exports.ActionList = void 0;
|
|
26
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
+
var react_1 = require("react");
|
|
28
|
+
var react_native_1 = require("react-native");
|
|
29
|
+
var hooks_1 = require("../../hooks");
|
|
30
|
+
var styled_1 = require("./styled");
|
|
31
|
+
var ACTION_TYPES = {
|
|
32
|
+
back: 'chevron-left-small',
|
|
33
|
+
// edit: 'arrow-right', /* TODO: add pencil + paper icon */
|
|
34
|
+
external: 'new-window',
|
|
35
|
+
link: 'chevron-right-small',
|
|
36
|
+
};
|
|
37
|
+
var ActionList = function (_a) {
|
|
38
|
+
var children = _a.children, inverted = _a.inverted, rest = __rest(_a, ["children", "inverted"]);
|
|
39
|
+
var childCount = children.length;
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(styled_1.StyledActionList, __assign({}, rest, { children: react_1.Children.map(children, function (child, index) {
|
|
41
|
+
var _a;
|
|
42
|
+
return (0, react_1.cloneElement)(child, {
|
|
43
|
+
index: index,
|
|
44
|
+
hasBorder: childCount > 1 && index !== childCount - 1,
|
|
45
|
+
inList: childCount !== 1 ? true : false,
|
|
46
|
+
inverted: (_a = child.props.inverted) !== null && _a !== void 0 ? _a : inverted, // prioritise child prop
|
|
47
|
+
});
|
|
48
|
+
}) })));
|
|
49
|
+
};
|
|
50
|
+
exports.ActionList = ActionList;
|
|
51
|
+
var ActionWrapper = function (_a) {
|
|
52
|
+
var children = _a.children, accessibilityRole = _a.accessibilityRole, _b = _a.activeOpacity, activeOpacity = _b === void 0 ? 0.75 : _b, _c = _a.hasBorder, hasBorder = _c === void 0 ? false : _c, _d = _a.inList, inList = _d === void 0 ? false : _d, _e = _a.inverted, inverted = _e === void 0 ? false : _e, onPress = _a.onPress, testID = _a.testID, rest = __rest(_a, ["children", "accessibilityRole", "activeOpacity", "hasBorder", "inList", "inverted", "onPress", "testID"]);
|
|
53
|
+
return ((0, jsx_runtime_1.jsx)(styled_1.StyledActionWrapper, __assign({ hasBorder: hasBorder, inList: inList, inverted: inverted, testID: testID }, rest, { children: (0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, __assign({ activeOpacity: activeOpacity, accessibilityRole: accessibilityRole, onPress: onPress }, { children: (0, jsx_runtime_1.jsx)(styled_1.StyledActionInner, { children: children }) })) })));
|
|
54
|
+
};
|
|
55
|
+
var Action = function (_a) {
|
|
56
|
+
var _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'link' : _b, _c = _a.actionType, actionType = _c === void 0 ? 'link' : _c, children = _a.children, _d = _a.inverted, inverted = _d === void 0 ? false : _d, onPress = _a.onPress, testID = _a.testID, rest = __rest(_a, ["accessibilityRole", "actionType", "children", "inverted", "onPress", "testID"]);
|
|
57
|
+
var smallAndUp = (0, hooks_1.useBreakpoint)().smallAndUp;
|
|
58
|
+
return ((0, jsx_runtime_1.jsxs)(ActionWrapper, __assign({ accessibilityRole: accessibilityRole, inverted: inverted, onPress: onPress, testID: testID }, rest, { children: [actionType === 'back' ? ((0, jsx_runtime_1.jsx)(styled_1.StyledLeftIcon, { inverted: inverted, name: ACTION_TYPES['back'], size: 16 })) : null, (0, jsx_runtime_1.jsx)(styled_1.StyledActionText, __assign({ smallAndUp: smallAndUp, inverted: inverted }, { children: children })), actionType !== 'back' ? ((0, jsx_runtime_1.jsx)(styled_1.StyledRightIcon, { inverted: inverted, name: ACTION_TYPES[actionType], marginTop: actionType === 'link' ? 1 : 0, size: 16 })) : null] })));
|
|
59
|
+
};
|
|
60
|
+
exports.Action = Action;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActionList';
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./ActionList"), exports);
|