@ovotech/element-native 3.0.0 → 3.1.0-canary-9ecd91d-105

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.
Files changed (88) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +1 -1
  2. package/dist/components/Accordion/Accordion.js +9 -6
  3. package/dist/components/Accordion/Group.d.ts +4 -1
  4. package/dist/components/Accordion/Group.js +24 -10
  5. package/dist/components/Accordion/styles.d.ts +3 -3
  6. package/dist/components/Accordion/types.d.ts +3 -3
  7. package/dist/components/ActionList/ActionList.d.ts +22 -0
  8. package/dist/components/ActionList/ActionList.js +60 -0
  9. package/dist/components/ActionList/index.d.ts +1 -0
  10. package/dist/components/ActionList/index.js +17 -0
  11. package/dist/components/ActionList/styled.d.ts +1155 -0
  12. package/dist/components/ActionList/styled.js +57 -0
  13. package/dist/components/Badge/Badge.d.ts +1 -1
  14. package/dist/components/CTAButton/CTAButton.d.ts +3 -3
  15. package/dist/components/CTALink/CTALink.d.ts +3 -3
  16. package/dist/components/Card/Card.d.ts +1 -1
  17. package/dist/components/DataTable/styles.d.ts +11 -11
  18. package/dist/components/DescriptionList/styled.d.ts +1 -1
  19. package/dist/components/Divider/Divider.js +3 -1
  20. package/dist/components/ErrorText/ErrorText.d.ts +1 -1
  21. package/dist/components/FormGroup/FormGroup.js +1 -0
  22. package/dist/components/Grid/Col.d.ts +1 -1
  23. package/dist/components/Grid/Row.d.ts +1 -1
  24. package/dist/components/HintText/HintText.d.ts +1 -1
  25. package/dist/components/Icon/Icon.d.ts +2 -2
  26. package/dist/components/Input/CurrencyInput.d.ts +2 -2
  27. package/dist/components/Input/EmailInput.d.ts +2 -2
  28. package/dist/components/Input/Input.d.ts +5 -5
  29. package/dist/components/Input/NumberInput.d.ts +2 -2
  30. package/dist/components/Input/PasswordInput.d.ts +2 -2
  31. package/dist/components/Input/PasswordInput.styled.d.ts +1 -1
  32. package/dist/components/Input/PasswordVisibilityToggle.d.ts +2 -1
  33. package/dist/components/Input/PhoneInput.d.ts +2 -2
  34. package/dist/components/Input/TextInput.d.ts +2 -2
  35. package/dist/components/Input/TextareaInput.d.ts +2 -2
  36. package/dist/components/LabelText/LabelText.d.ts +1 -1
  37. package/dist/components/List/List.d.ts +3 -3
  38. package/dist/components/Margin/Margin.d.ts +4 -1
  39. package/dist/components/Notification/Notification.d.ts +2 -2
  40. package/dist/components/Radio/Radio.js +2 -2
  41. package/dist/components/SelectField/Select.d.ts +2 -1
  42. package/dist/components/SelectField/Select.js +15 -14
  43. package/dist/components/SkeletonLoading/Skeleton.d.ts +1 -1
  44. package/dist/components/SubLabelText/SubLabelText.d.ts +1 -1
  45. package/dist/components/Text/Text.d.ts +5 -5
  46. package/dist/components/TextField/CurrencyField.d.ts +2 -2
  47. package/dist/components/TextField/EmailField.d.ts +2 -2
  48. package/dist/components/TextField/NumberField.d.ts +2 -2
  49. package/dist/components/TextField/PasswordField.d.ts +2 -2
  50. package/dist/components/TextField/PhoneField.d.ts +2 -2
  51. package/dist/components/TextField/TelField.d.ts +2 -2
  52. package/dist/components/TextField/TextField.d.ts +2 -2
  53. package/dist/components/TextField/TextareaField.d.ts +2 -2
  54. package/dist/components/index.d.ts +1 -0
  55. package/dist/components/index.js +1 -0
  56. package/dist/esm/components/Accordion/Accordion.js +9 -6
  57. package/dist/esm/components/Accordion/Group.js +24 -10
  58. package/dist/esm/components/ActionList/ActionList.js +56 -0
  59. package/dist/esm/components/ActionList/index.js +1 -0
  60. package/dist/esm/components/ActionList/styled.js +31 -0
  61. package/dist/esm/components/Divider/Divider.js +3 -1
  62. package/dist/esm/components/FormGroup/FormGroup.js +1 -0
  63. package/dist/esm/components/Radio/Radio.js +2 -2
  64. package/dist/esm/components/SelectField/Select.js +14 -16
  65. package/dist/esm/components/index.js +1 -0
  66. package/dist/esm/utils/utils.js +1 -0
  67. package/dist/providers/IconsProvider.d.ts +1 -1
  68. package/dist/providers/types.d.ts +1 -0
  69. package/dist/styled.native.d.ts +6 -6
  70. package/dist/theme/create-theme.d.ts +1 -1
  71. package/dist/theme/index.d.ts +1 -1
  72. package/dist/utils/utils.js +1 -0
  73. package/package.json +4 -2
  74. package/dist/components/Input/TelInput.d.ts +0 -10
  75. package/dist/components/Input/TelInput.js +0 -41
  76. package/dist/esm/components/Input/TelInput.js +0 -15
  77. package/dist/esm/providers/icons/HidePassword.js +0 -15
  78. package/dist/esm/providers/icons/Payment.js +0 -15
  79. package/dist/esm/providers/icons/ShowPassword.js +0 -15
  80. package/dist/esm/providers/icons/Usage.js +0 -15
  81. package/dist/providers/icons/HidePassword.d.ts +0 -2
  82. package/dist/providers/icons/HidePassword.js +0 -22
  83. package/dist/providers/icons/Payment.d.ts +0 -2
  84. package/dist/providers/icons/Payment.js +0 -22
  85. package/dist/providers/icons/ShowPassword.d.ts +0 -2
  86. package/dist/providers/icons/ShowPassword.js +0 -22
  87. package/dist/providers/icons/Usage.d.ts +0 -2
  88. package/dist/providers/icons/Usage.js +0 -22
@@ -232,7 +232,7 @@ export declare const P: import("react").ForwardRefExoticComponent<Pick<Omit<{
232
232
  };
233
233
  };
234
234
  };
235
- }) | undefined;
235
+ } & object) | undefined;
236
236
  } & {
237
237
  as?: string | import("react").ComponentType<any> | undefined;
238
238
  forwardedAs?: string | import("react").ComponentType<any> | undefined;
@@ -469,7 +469,7 @@ export declare const Small: import("react").ForwardRefExoticComponent<Pick<Omit<
469
469
  };
470
470
  };
471
471
  };
472
- }) | undefined;
472
+ } & object) | undefined;
473
473
  } & {
474
474
  as?: string | import("react").ComponentType<any> | undefined;
475
475
  forwardedAs?: string | import("react").ComponentType<any> | undefined;
@@ -701,7 +701,7 @@ export declare const Strong: import("styled-components").StyledComponent<typeof
701
701
  };
702
702
  };
703
703
  };
704
- }, {}, never>;
704
+ } & object, {}, never>;
705
705
  export declare const Em: import("styled-components").StyledComponent<typeof import("react-native").Text, import("../../theme/theme").Theme & {
706
706
  core: {
707
707
  radius: Record<"small" | "medium" | "large" | "max", string>;
@@ -929,7 +929,7 @@ export declare const Em: import("styled-components").StyledComponent<typeof impo
929
929
  };
930
930
  };
931
931
  };
932
- }, {}, never>;
932
+ } & object, {}, never>;
933
933
  export declare const LineThrough: import("styled-components").StyledComponent<typeof import("react-native").Text, import("../../theme/theme").Theme & {
934
934
  core: {
935
935
  radius: Record<"small" | "medium" | "large" | "max", string>;
@@ -1157,5 +1157,5 @@ export declare const LineThrough: import("styled-components").StyledComponent<ty
1157
1157
  };
1158
1158
  };
1159
1159
  };
1160
- }, {}, never>;
1160
+ } & object, {}, never>;
1161
1161
  export declare const TextGroup: ({ children, ...rest }: PropsWithChildren<ViewProps>) => JSX.Element;
@@ -4,8 +4,8 @@ import { FieldProps } from '../Field';
4
4
  export declare const CurrencyField: import("react").ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
- iconLeft?: import("../../providers").IconName | undefined;
8
- iconRight?: import("../../providers").IconName | undefined;
7
+ iconLeft?: string | undefined;
8
+ iconRight?: string | undefined;
9
9
  rightSlot?: import("react").ReactNode;
10
10
  } & {
11
11
  currency?: "GBP" | "EUR" | "AUD" | "USD" | undefined;
@@ -4,7 +4,7 @@ import { FieldProps } from '../Field';
4
4
  export declare const EmailField: import("react").ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
- iconLeft?: import("../../providers").IconName | undefined;
8
- iconRight?: import("../../providers").IconName | undefined;
7
+ iconLeft?: string | undefined;
8
+ iconRight?: string | undefined;
9
9
  rightSlot?: import("react").ReactNode;
10
10
  } & import("react").RefAttributes<NativeTextInput>>;
@@ -4,7 +4,7 @@ import { FieldProps } from '../Field';
4
4
  export declare const NumberField: import("react").ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
- iconLeft?: import("../../providers").IconName | undefined;
8
- iconRight?: import("../../providers").IconName | undefined;
7
+ iconLeft?: string | undefined;
8
+ iconRight?: string | undefined;
9
9
  rightSlot?: import("react").ReactNode;
10
10
  } & import("react").RefAttributes<NativeTextInput>>;
@@ -4,8 +4,8 @@ import { FieldProps } from '../Field';
4
4
  export declare const PasswordField: import("react").ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
- iconLeft?: import("../../providers").IconName | undefined;
8
- iconRight?: import("../../providers").IconName | undefined;
7
+ iconLeft?: string | undefined;
8
+ iconRight?: string | undefined;
9
9
  rightSlot?: import("react").ReactNode;
10
10
  } & {
11
11
  hasVisibilityToggle?: boolean | undefined;
@@ -4,7 +4,7 @@ import { FieldProps } from '../Field';
4
4
  export declare const PhoneField: import("react").ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
- iconLeft?: import("../../providers").IconName | undefined;
8
- iconRight?: import("../../providers").IconName | undefined;
7
+ iconLeft?: string | undefined;
8
+ iconRight?: string | undefined;
9
9
  rightSlot?: import("react").ReactNode;
10
10
  } & import("react").RefAttributes<NativeTextInput>>;
@@ -8,7 +8,7 @@ import { FieldProps } from '../Field';
8
8
  export declare const TelField: import("react").ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
9
9
  invalid?: boolean | undefined;
10
10
  stretch?: boolean | undefined;
11
- iconLeft?: import("../../providers").IconName | undefined;
12
- iconRight?: import("../../providers").IconName | undefined;
11
+ iconLeft?: string | undefined;
12
+ iconRight?: string | undefined;
13
13
  rightSlot?: import("react").ReactNode;
14
14
  } & import("react").RefAttributes<NativeTextInput>>;
@@ -4,7 +4,7 @@ import { FieldProps } from '../Field';
4
4
  export declare const TextField: import("react").ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
- iconLeft?: import("../../providers").IconName | undefined;
8
- iconRight?: import("../../providers").IconName | undefined;
7
+ iconLeft?: string | undefined;
8
+ iconRight?: string | undefined;
9
9
  rightSlot?: import("react").ReactNode;
10
10
  } & import("react").RefAttributes<NativeTextInput>>;
@@ -4,8 +4,8 @@ import { FieldProps } from '../Field';
4
4
  export declare const TextareaField: import("react").ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
- iconLeft?: import("../../providers").IconName | undefined;
8
- iconRight?: import("../../providers").IconName | undefined;
7
+ iconLeft?: string | undefined;
8
+ iconRight?: string | undefined;
9
9
  rightSlot?: import("react").ReactNode;
10
10
  } & {
11
11
  rows?: number | undefined;
@@ -1,4 +1,5 @@
1
1
  export * from './Accordion';
2
+ export * from './ActionList';
2
3
  export * from './Badge';
3
4
  export * from './Card';
4
5
  export * from './Checkbox';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Accordion"), exports);
18
+ __exportStar(require("./ActionList"), exports);
18
19
  __exportStar(require("./Badge"), exports);
19
20
  __exportStar(require("./Card"), exports);
20
21
  __exportStar(require("./Checkbox"), exports);
@@ -30,6 +30,7 @@ import Animated, { interpolateColor, runOnUI, useAnimatedStyle, useDerivedValue,
30
30
  import { ThemeContext } from '../../styled.native';
31
31
  import { pxToNumber } from '../../utils';
32
32
  import { Heading4 } from '../Heading';
33
+ import { AccordionGroupContext } from './Group';
33
34
  import { AccordionIcon } from './Icon';
34
35
  import { useLayout } from './hooks';
35
36
  import { StyledAccordion, StyledAccordionHeader, StyledContainer, } from './styles';
@@ -50,13 +51,15 @@ export function withAnimated(WrappedComponent) {
50
51
  return Animated.createAnimatedComponent(WithAnimated);
51
52
  }
52
53
  export var Accordion = function (_a) {
53
- var _b = _a.expanded, expanded = _b === void 0 ? false : _b, first = _a.first, _c = _a.headingComponent, headingComponent = _c === void 0 ? Heading4 : _c, last = _a.last, title = _a.title, children = _a.children, onToggle = _a.onToggle;
54
- var _d = useContext(ThemeContext), core = _d.core, semantic = _d.semantic;
55
- var AnimatedHeading = useMemo(function () { return withAnimated(headingComponent); }, [
56
- headingComponent,
54
+ 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;
55
+ var _c = useContext(ThemeContext), core = _c.core, semantic = _c.semantic;
56
+ var Header = useContext(AccordionGroupContext).Header;
57
+ var AccordionHeading = Header !== null && Header !== void 0 ? Header : Heading4;
58
+ var AnimatedHeading = useMemo(function () { return withAnimated(AccordionHeading); }, [
59
+ AccordionHeading,
57
60
  ]);
58
- var _e = useLayout(0), layout = _e[0], onLayout = _e[1];
59
- var _f = useState(expanded), open = _f[0], setOpen = _f[1];
61
+ var _d = useLayout(0), layout = _d[0], onLayout = _d[1];
62
+ var _e = useState(expanded), open = _e[0], setOpen = _e[1];
60
63
  var handleHeightContent = useMemo(function () { return layout.height || 100; }, [
61
64
  layout.height,
62
65
  ]);
@@ -1,15 +1,29 @@
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
+ };
1
12
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Children, cloneElement, isValidElement, } from 'react';
13
+ import { Children, cloneElement, createContext, isValidElement, } from 'react';
3
14
  import { View } from 'react-native';
15
+ export var AccordionGroupContext = createContext({
16
+ Header: undefined,
17
+ });
4
18
  export var AccordionGroup = function (_a) {
5
- var children = _a.children;
19
+ var children = _a.children, headingComponent = _a.headingComponent;
6
20
  var childCount = Children.count(children);
7
- return (_jsx(View, { children: Children.map(children, function (child, i) {
8
- return isValidElement(child)
9
- ? cloneElement(child, {
10
- first: i === 0,
11
- last: i === childCount - 1,
12
- })
13
- : child;
14
- }) }));
21
+ return (_jsx(AccordionGroupContext.Provider, __assign({ value: { Header: headingComponent } }, { children: _jsx(View, { children: Children.map(children, function (child, i) {
22
+ return isValidElement(child)
23
+ ? cloneElement(child, {
24
+ first: i === 0,
25
+ last: i === childCount - 1,
26
+ })
27
+ : child;
28
+ }) }) })));
15
29
  };
@@ -0,0 +1,56 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import { Children, cloneElement, } from 'react';
25
+ import { TouchableOpacity, } from 'react-native';
26
+ import { useBreakpoint } from '../../hooks';
27
+ import { StyledActionInner, StyledActionList, StyledActionText, StyledActionWrapper, StyledLeftIcon, StyledRightIcon, } from './styled';
28
+ var ACTION_TYPES = {
29
+ back: 'chevron-left-small',
30
+ // edit: 'arrow-right', /* TODO: add pencil + paper icon */
31
+ external: 'new-window',
32
+ link: 'chevron-right-small',
33
+ };
34
+ var ActionList = function (_a) {
35
+ var children = _a.children, inverted = _a.inverted, rest = __rest(_a, ["children", "inverted"]);
36
+ var childCount = children.length;
37
+ return (_jsx(StyledActionList, __assign({}, rest, { children: Children.map(children, function (child, index) {
38
+ var _a;
39
+ return cloneElement(child, {
40
+ index: index,
41
+ hasBorder: childCount > 1 && index !== childCount - 1,
42
+ inList: childCount !== 1 ? true : false,
43
+ inverted: (_a = child.props.inverted) !== null && _a !== void 0 ? _a : inverted, // prioritise child prop
44
+ });
45
+ }) })));
46
+ };
47
+ var ActionWrapper = function (_a) {
48
+ 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"]);
49
+ return (_jsx(StyledActionWrapper, __assign({ hasBorder: hasBorder, inList: inList, inverted: inverted, testID: testID }, rest, { children: _jsx(TouchableOpacity, __assign({ activeOpacity: activeOpacity, accessibilityRole: accessibilityRole, onPress: onPress }, { children: _jsx(StyledActionInner, { children: children }) })) })));
50
+ };
51
+ var Action = function (_a) {
52
+ 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"]);
53
+ var smallAndUp = useBreakpoint().smallAndUp;
54
+ return (_jsxs(ActionWrapper, __assign({ accessibilityRole: accessibilityRole, inverted: inverted, onPress: onPress, testID: testID }, rest, { children: [actionType === 'back' ? (_jsx(StyledLeftIcon, { inverted: inverted, name: ACTION_TYPES['back'], size: 16 })) : null, _jsx(StyledActionText, __assign({ smallAndUp: smallAndUp, inverted: inverted }, { children: children })), actionType !== 'back' ? (_jsx(StyledRightIcon, { inverted: inverted, name: ACTION_TYPES[actionType], marginTop: actionType === 'link' ? 1 : 0, size: 16 })) : null] })));
55
+ };
56
+ export { ActionList, Action };
@@ -0,0 +1 @@
1
+ export * from './ActionList';
@@ -0,0 +1,31 @@
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 styled, { css } from '../../styled.native';
6
+ import { Icon } from '../Icon';
7
+ import { ListWrapper } from '../List/List';
8
+ export var StyledActionList = ListWrapper;
9
+ export var StyledActionWrapper = styled.View(function (_a) {
10
+ var _b = _a.theme, core = _b.core, semantic = _b.semantic, hasBorder = _a.hasBorder, inList = _a.inList, inverted = _a.inverted;
11
+ return "\n width: ".concat(inList ? '100%' : 'auto', ";\n align-self: ").concat(inList ? 'center' : 'flex-start', ";\n border-bottom-width: ").concat(hasBorder ? core.borderWidth.small : 0, ";\n border-bottom-style: solid;\n border-bottom-color: ").concat(inverted ? semantic.inverted.border : semantic.border.graphic, ";\n");
12
+ });
13
+ export var StyledActionInner = styled.View(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n min-height: 44px;\n"], ["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n min-height: 44px;\n"])));
14
+ export var StyledActionText = styled.Text(function (_a) {
15
+ var _b = _a.theme, core = _b.core, semantic = _b.semantic, smallAndUp = _a.smallAndUp, _c = _a.inverted, inverted = _c === void 0 ? false : _c;
16
+ var fontSize = smallAndUp
17
+ ? core.fontSize.body.large
18
+ : core.fontSize.body.small;
19
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n "], ["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n "])), inverted ? semantic.inverted.message.base : semantic.message.base, core.fontFamily.bodyBold.native, fontSize, core.lineHeight.body.small);
20
+ });
21
+ export var StyledRightIcon = styled(Icon)(function (_a) {
22
+ var _b = _a.theme, core = _b.core, semantic = _b.semantic, inverted = _a.inverted, marginTop = _a.marginTop;
23
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n color: ", ";\n margin-left: ", ";\n margin-top: ", ";\n "], ["\n color: ", ";\n margin-left: ", ";\n margin-top: ", ";\n "])), inverted ? semantic.inverted.message.base : semantic.message.base, core.space[1], core.space[marginTop]);
24
+ });
25
+ export var StyledLeftIcon = styled(Icon)(function (_a) {
26
+ var _b = _a.theme, core = _b.core, semantic = _b.semantic, inverted = _a.inverted;
27
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n margin-right: ", ";\n "], ["\n color: ", ";\n margin-right: ", ";\n "])), inverted
28
+ ? semantic.inverted.message.base
29
+ : semantic.message.base, core.space[1]);
30
+ });
31
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -6,7 +6,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import styled, { css } from '../../styled.native';
7
7
  var StyledDivider = styled.View(function (_a) {
8
8
  var semantic = _a.theme.semantic, _b = _a.type, type = _b === void 0 ? 'default' : _b, _c = _a.width, width = _c === void 0 ? '100%' : _c;
9
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 1px;\n background: ", ";\n width: ", ";\n "], ["\n height: 1px;\n background: ", ";\n width: ", ";\n "])), type === 'default' ? semantic.border.graphic : semantic.border.differentiated, width);
9
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 1px;\n background: ", ";\n width: ", ";\n "], ["\n height: 1px;\n background: ", ";\n width: ", ";\n "])), type === 'default'
10
+ ? semantic.border.graphic
11
+ : semantic.border.differentiated, width);
10
12
  });
11
13
  export var Divider = function (_a) {
12
14
  var type = _a.type, width = _a.width;
@@ -28,6 +28,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
28
28
  import { View } from 'react-native';
29
29
  import styled from '../../styled.native';
30
30
  var FormGroupWrapper = styled.View(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: row;\n"], ["\n flex-direction: row;\n"])));
31
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
31
32
  var FormGroup = function (_a) {
32
33
  var children = _a.children, error = _a.error, rest = __rest(_a, ["children", "error"]);
33
34
  return (_jsx(FormGroupWrapper, __assign({}, rest, { children: _jsx(View, __assign({ style: { flex: 1 } }, { children: children })) })));
@@ -32,7 +32,7 @@ var StyledRadioInputWrapper = styled.View(function (_a) {
32
32
  });
33
33
  var StyledRadioInput = styled.View(function (_a) {
34
34
  var _b = _a.theme, core = _b.core, semantic = _b.semantic, invalid = _a.invalid, checked = _a.checked;
35
- return "\n width: ".concat(core.space[6], ";\n height: ").concat(core.space[6], ";\n border: ").concat(core.borderWidth.small, " solid;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n border-color: ").concat(invalid
35
+ return "\n width: ".concat(core.space[6], ";\n height: ").concat(core.space[6], ";\n border: ").concat(core.borderWidth.small, " solid;\n align-items: center;\n justify-content: center;\n border-radius: ").concat(core.space[6], ";\n border-color: ").concat(invalid
36
36
  ? semantic.error.border
37
37
  : checked
38
38
  ? core.color.blue.dark
@@ -40,7 +40,7 @@ var StyledRadioInput = styled.View(function (_a) {
40
40
  });
41
41
  var StyledRadioInputDot = styled.View(function (_a) {
42
42
  var core = _a.theme.core, checked = _a.checked;
43
- return "\n width: ".concat(core.space[3], ";\n height: ").concat(core.space[3], ";\n border-radius: 50%;\n background: ").concat(core.color.blue.dark, ";\n opacity: ").concat(checked ? 1 : 0, ";\n ");
43
+ return "\n width: ".concat(core.space[3], ";\n height: ").concat(core.space[3], ";\n border-radius: ").concat(core.space[3], ";\n background: ").concat(core.color.blue.dark, ";\n opacity: ").concat(checked ? 1 : 0, ";\n ");
44
44
  });
45
45
  var Input = function (_a) {
46
46
  var checked = _a.checked, invalid = _a.invalid, testID = _a.testID, rest = __rest(_a, ["checked", "invalid", "testID"]);
@@ -13,17 +13,9 @@ var __assign = (this && this.__assign) || function () {
13
13
  };
14
14
  return __assign.apply(this, arguments);
15
15
  };
16
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
17
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
18
- if (ar || !(i in from)) {
19
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
20
- ar[i] = from[i];
21
- }
22
- }
23
- return to.concat(ar || Array.prototype.slice.call(from));
24
- };
25
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
26
- import { useState } from 'react';
17
+ import groupBy from 'lodash.groupby';
18
+ import { Fragment, useState } from 'react';
27
19
  import { Modal, ScrollView, View } from 'react-native';
28
20
  import styled, { css } from '../../styled.native';
29
21
  import { Icon } from '../Icon';
@@ -56,7 +48,11 @@ var RadioDot = styled.View(function (_a) {
56
48
  });
57
49
  var StyledP = styled(P)(function (_a) {
58
50
  var core = _a.theme.core;
59
- return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-top: ", ";\n "], ["\n margin-top: ", ";\n "])), core.space[3]);
51
+ return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-top: ", ";\n margin-bottom: ", ";\n "], ["\n margin-top: ", ";\n margin-bottom: ", ";\n "])), core.space[3], core.space[3]);
52
+ });
53
+ var StyledCategory = styled(P)(function (_a) {
54
+ var _b = _a.theme, core = _b.core, semantic = _b.semantic;
55
+ return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n font-size: ", ";\n color: ", "\n background-color: ", ";\n padding-horizontal: ", ";\n padding-vertical: ", ";\n "], ["\n font-size: ", ";\n color: ", "\n background-color: ", ";\n padding-horizontal: ", ";\n padding-vertical: ", ";\n "])), core.fontSize.label.large, semantic.message.secondary, semantic.surface.cutout, core.space[4], core.space[1]);
60
56
  });
61
57
  export var Select = function (_a) {
62
58
  var _b = _a.options, options = _b === void 0 ? [] : _b, _c = _a.defaultSelected, defaultSelected = _c === void 0 ? { label: '', value: 'default' } : _c, _d = _a.noOptionMessage, noOptionMessage = _d === void 0 ? 'No option selected' : _d, _e = _a.onSelected, onSelected = _e === void 0 ? function () { return null; } : _e, _f = _a.hasError, hasError = _f === void 0 ? false : _f, _g = _a.testID, testID = _g === void 0 ? 'select' : _g;
@@ -67,9 +63,11 @@ export var Select = function (_a) {
67
63
  setOpen(false);
68
64
  setSelected(val);
69
65
  };
70
- var extendedOptions = __spreadArray([
71
- { label: "-- ".concat(noOptionMessage, " --"), value: 'default' }
72
- ], options, true);
73
- return (_jsxs(View, { children: [_jsxs(SelectInput, __assign({ testID: testID, hasError: hasError, onPress: function () { return setOpen(!isOpen); } }, { children: [_jsx(P, __assign({ style: { marginTop: 0, marginBottom: 0 } }, { children: selected.value === 'default' ? '' : selected.label })), _jsx(Icon, { name: "chevron-down", size: 16, style: { marginLeft: 'auto' } })] })), _jsx(Modal, __assign({ transparent: true, visible: isOpen, animationType: "fade", onRequestClose: function () { return setOpen(false); } }, { children: _jsx(DropdownWrapper, { children: _jsx(DropdownContainer, { children: _jsx(ScrollView, __assign({ nestedScrollEnabled: true }, { children: extendedOptions.map(function (option, i) { return (_jsxs(SelectOption, __assign({ accessibilityRole: "radio", isLastOption: i === extendedOptions.length - 1, onPress: function () { return handleOptionPress(option); } }, { children: [_jsx(StyledP, { children: _jsx(Strong, { children: option.label }) }), _jsx(Radio, __assign({ isChecked: selected.value === option.value }, { children: _jsx(RadioDot, { isChecked: selected.value === option.value }) }))] }), option.label)); }) })) }) }) }))] }));
66
+ var optionsByCategories = groupBy(options, 'category');
67
+ var requiredOption = {
68
+ label: "-- ".concat(noOptionMessage, " --"),
69
+ value: 'default',
70
+ };
71
+ return (_jsxs(View, { children: [_jsxs(SelectInput, __assign({ testID: testID, hasError: hasError, onPress: function () { return setOpen(!isOpen); } }, { children: [_jsx(P, __assign({ style: { marginTop: 0, marginBottom: 0 } }, { children: selected.value === 'default' ? '' : selected.label })), _jsx(Icon, { name: "chevron-down", size: 16, style: { marginLeft: 'auto' } })] })), _jsx(Modal, __assign({ transparent: true, visible: isOpen, animationType: "fade", onRequestClose: function () { return setOpen(false); } }, { children: _jsx(DropdownWrapper, { children: _jsx(DropdownContainer, { children: _jsxs(ScrollView, __assign({ nestedScrollEnabled: true }, { children: [_jsxs(SelectOption, __assign({ accessibilityRole: "radio", onPress: function () { return handleOptionPress(requiredOption); } }, { children: [_jsx(StyledP, { children: _jsx(Strong, { children: requiredOption.label }) }), _jsx(Radio, __assign({ isChecked: selected.value === requiredOption.value }, { children: _jsx(RadioDot, { isChecked: selected.value === requiredOption.value }) }))] })), Object.keys(optionsByCategories).map(function (category) { return (_jsxs(Fragment, { children: [category !== 'undefined' ? (_jsx(StyledCategory, { children: category })) : null, optionsByCategories[category].map(function (option, i) { return (_jsxs(SelectOption, __assign({ accessibilityRole: "radio", isLastOption: i === optionsByCategories[category].length - 1, onPress: function () { return handleOptionPress(option); } }, { children: [_jsx(StyledP, { children: _jsx(Strong, { children: option.label }) }), _jsx(Radio, __assign({ isChecked: selected.value === option.value }, { children: _jsx(RadioDot, { isChecked: selected.value === option.value }) }))] }), option.label)); })] }, category)); })] })) }) }) }))] }));
74
72
  };
75
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
73
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
@@ -1,4 +1,5 @@
1
1
  export * from './Accordion';
2
+ export * from './ActionList';
2
3
  export * from './Badge';
3
4
  export * from './Card';
4
5
  export * from './Checkbox';
@@ -78,6 +78,7 @@ function getErrorMessage(id, errors) {
78
78
  }) || { message: null })
79
79
  .message;
80
80
  }
81
+ // eslint-disable-next-line @typescript-eslint/ban-types
81
82
  function callAll() {
82
83
  var fns = [];
83
84
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -1,7 +1,7 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { IconsType } from './types';
3
3
  declare const defaultIcons: IconsType;
4
- declare function useIcons<T extends IconsType = {}>(): IconsType & T;
4
+ declare function useIcons<T extends IconsType = string & object>(): IconsType & T;
5
5
  declare function IconsProvider({ children, icons, }: PropsWithChildren<{
6
6
  icons?: IconsType;
7
7
  }>): JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import { SvgProps } from 'react-native-svg';
3
3
  export declare type IconName = 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrow-up' | 'caret-down' | 'caret-left' | 'caret-right' | 'caret-up' | 'chart' | 'check' | 'chevron-down' | 'chevron-left' | 'chevron-left-small' | 'chevron-left-small-first' | 'chevron-right' | 'chevron-right-small' | 'chevron-right-small-last' | 'chevron-up' | 'cross' | 'dollar' | 'download' | 'electricity' | 'euro' | 'gas' | 'help' | 'hide' | 'home' | 'info' | 'link' | 'logo' | 'minus' | 'new-window' | 'payment-card' | 'plus' | 'pound' | 'search' | 'show' | 'user';
4
+ export declare type IconNameExtended = IconName | string;
4
5
  export declare type IconsType = Record<string, FunctionComponent<SvgProps>>;
@@ -228,7 +228,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<import("./them
228
228
  };
229
229
  };
230
230
  };
231
- }>, css: import("styled-components").ThemedCssFunction<import("./theme/theme").Theme & {
231
+ } & object>, css: import("styled-components").ThemedCssFunction<import("./theme/theme").Theme & {
232
232
  core: {
233
233
  radius: Record<"small" | "medium" | "large" | "max", string>;
234
234
  borderWidth: Record<"small" | "medium" | "large", string>;
@@ -455,7 +455,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<import("./them
455
455
  };
456
456
  };
457
457
  };
458
- }>, ThemeProvider: import("styled-components").ThemeProviderComponent<import("./theme/theme").Theme & {
458
+ } & object>, ThemeProvider: import("styled-components").ThemeProviderComponent<import("./theme/theme").Theme & {
459
459
  core: {
460
460
  radius: Record<"small" | "medium" | "large" | "max", string>;
461
461
  borderWidth: Record<"small" | "medium" | "large", string>;
@@ -682,7 +682,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<import("./them
682
682
  };
683
683
  };
684
684
  };
685
- }, import("./theme/theme").Theme & {
685
+ } & object, import("./theme/theme").Theme & {
686
686
  core: {
687
687
  radius: Record<"small" | "medium" | "large" | "max", string>;
688
688
  borderWidth: Record<"small" | "medium" | "large", string>;
@@ -909,7 +909,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<import("./them
909
909
  };
910
910
  };
911
911
  };
912
- }>, ThemeContext: import("react").Context<import("./theme/theme").Theme & {
912
+ } & object>, ThemeContext: import("react").Context<import("./theme/theme").Theme & {
913
913
  core: {
914
914
  radius: Record<"small" | "medium" | "large" | "max", string>;
915
915
  borderWidth: Record<"small" | "medium" | "large", string>;
@@ -1136,7 +1136,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<import("./them
1136
1136
  };
1137
1137
  };
1138
1138
  };
1139
- }>, useTheme: () => import("./theme/theme").Theme & {
1139
+ } & object>, useTheme: () => import("./theme/theme").Theme & {
1140
1140
  core: {
1141
1141
  radius: Record<"small" | "medium" | "large" | "max", string>;
1142
1142
  borderWidth: Record<"small" | "medium" | "large", string>;
@@ -1363,6 +1363,6 @@ declare const styled: styledComponents.ReactNativeStyledInterface<import("./them
1363
1363
  };
1364
1364
  };
1365
1365
  };
1366
- };
1366
+ } & object;
1367
1367
  export { css, ThemeProvider, ThemeContext, useTheme };
1368
1368
  export default styled;
@@ -14,5 +14,5 @@ declare type OneLevelPartial<T> = {
14
14
  };
15
15
  export declare type RequiredThemeKeys = Pick<Theme, 'borderWidths' | 'radii' | 'breakpoints' | 'shadows' | 'space' | 'fonts' | 'lineHeights' | 'fontSizes' | 'responsiveFontSizes' | 'responsiveLineHeights' | 'colors'>;
16
16
  export declare const defaultTokens: RequiredThemeKeys;
17
- export declare function createTheme<T, A = {}>(customTheme: ThreeLevelPartial<Theme> & T, additional?: ThreeLevelPartial<Theme> & A): Theme & T & A;
17
+ export declare function createTheme<T, A = object>(customTheme: ThreeLevelPartial<Theme> & T, additional?: ThreeLevelPartial<Theme> & A): Theme & T & A;
18
18
  export {};
@@ -226,6 +226,6 @@ export declare const theme: import("./theme").Theme & {
226
226
  };
227
227
  };
228
228
  };
229
- };
229
+ } & object;
230
230
  export declare type Theme = typeof theme;
231
231
  export declare const calculateLineHeight: (size: string, lineHeight?: number) => string;
@@ -88,6 +88,7 @@ function getErrorMessage(id, errors) {
88
88
  .message;
89
89
  }
90
90
  exports.getErrorMessage = getErrorMessage;
91
+ // eslint-disable-next-line @typescript-eslint/ban-types
91
92
  function callAll() {
92
93
  var fns = [];
93
94
  for (var _i = 0; _i < arguments.length; _i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovotech/element-native",
3
- "version": "3.0.0",
3
+ "version": "3.1.0-canary-9ecd91d-105",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "url": "@ovotech/element"
14
14
  },
15
15
  "dependencies": {
16
- "@ovotech/element-core": "^2.0.0",
16
+ "@ovotech/element-core": "^2.0.0-canary-9ecd91d-105",
17
17
  "deepmerge": "^4.2.2"
18
18
  },
19
19
  "devDependencies": {
@@ -23,6 +23,7 @@
23
23
  "@testing-library/react-native": "^11.5.2",
24
24
  "@testing-library/user-event": "^14.4.3",
25
25
  "@types/jest": "^28.1.1",
26
+ "@types/lodash.groupby": "^4.6.7",
26
27
  "@types/react": "18.0.24",
27
28
  "@types/react-is": "^18.2.0",
28
29
  "@types/react-native": "^0.72.0",
@@ -33,6 +34,7 @@
33
34
  "babel-plugin-require-context-hook": "^1.0.0",
34
35
  "jest": "^28.1.1",
35
36
  "jest-styled-components": "^7.0.3",
37
+ "lodash.groupby": "^4.6.0",
36
38
  "metro-react-native-babel-preset": "^0.77.0",
37
39
  "react": "18.2.0",
38
40
  "react-is": "^16.13.0",
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { TextInput } from 'react-native';
3
- declare const TelInput: React.ForwardRefExoticComponent<import("react-native/types").TextInputProps & {
4
- invalid?: boolean | undefined;
5
- stretch?: boolean | undefined;
6
- iconLeft?: (string & {}) | import("../../providers").IconName | undefined;
7
- iconRight?: (string & {}) | import("../../providers").IconName | undefined;
8
- rightSlot?: React.ReactNode;
9
- } & React.RefAttributes<TextInput>>;
10
- export { TelInput };
@@ -1,41 +0,0 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.TelInput = void 0;
38
- var react_1 = __importStar(require("react"));
39
- var Input_1 = require("./Input");
40
- var TelInput = (0, react_1.forwardRef)(function (props, ref) { return (react_1.default.createElement(Input_1.Input, __assign({}, props, { keyboardType: "phone-pad", autoCapitalize: "none", autoCorrect: false, ref: ref }))); });
41
- exports.TelInput = TelInput;