@ovotech/element-native 2.0.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/components/Accordion/Accordion.js +5 -5
  2. package/dist/components/Accordion/types.d.ts +1 -0
  3. package/dist/components/Badge/Badge.d.ts +1 -0
  4. package/dist/components/Badge/Badge.js +6 -4
  5. package/dist/components/CTALink/CTALink.d.ts +3 -4
  6. package/dist/components/Checkbox/Checkbox.js +5 -7
  7. package/dist/components/Divider/Divider.d.ts +5 -0
  8. package/dist/components/Divider/Divider.js +45 -0
  9. package/dist/components/Divider/index.d.ts +1 -0
  10. package/dist/components/Divider/index.js +5 -0
  11. package/dist/components/Grid/Col.d.ts +1 -1
  12. package/dist/components/Input/CurrencyInput.d.ts +2 -1
  13. package/dist/components/Input/EmailInput.d.ts +2 -1
  14. package/dist/components/Input/Input.d.ts +3 -1
  15. package/dist/components/Input/Input.js +6 -5
  16. package/dist/components/Input/NumberInput.d.ts +2 -1
  17. package/dist/components/Input/PasswordInput.d.ts +4 -1
  18. package/dist/components/Input/PasswordInput.js +4 -2
  19. package/dist/components/Input/PasswordInput.styled.d.ts +4 -0
  20. package/dist/components/Input/PasswordInput.styled.js +40 -0
  21. package/dist/components/Input/PasswordVisibilityToggle.d.ts +11 -0
  22. package/dist/components/Input/PasswordVisibilityToggle.js +54 -0
  23. package/dist/components/Input/TelInput.d.ts +2 -1
  24. package/dist/components/Input/TextInput.d.ts +2 -1
  25. package/dist/components/Input/TextareaInput.d.ts +2 -1
  26. package/dist/components/List/List.js +1 -1
  27. package/dist/components/NavHeader/NavHeader.d.ts +1 -0
  28. package/dist/components/NavHeader/NavHeader.js +8 -10
  29. package/dist/components/Radio/Radio.js +5 -7
  30. package/dist/components/SkeletonLoading/SkeletonAnimation.d.ts +6 -0
  31. package/dist/components/SkeletonLoading/SkeletonAnimation.js +57 -0
  32. package/dist/components/SkeletonLoading/SkeletonCTA.js +3 -1
  33. package/dist/components/SkeletonLoading/SkeletonCircle.js +4 -2
  34. package/dist/components/SkeletonLoading/SkeletonHeading.js +3 -1
  35. package/dist/components/SkeletonLoading/SkeletonText.js +2 -2
  36. package/dist/components/TextField/CurrencyField.d.ts +2 -1
  37. package/dist/components/TextField/EmailField.d.ts +2 -1
  38. package/dist/components/TextField/NumberField.d.ts +2 -1
  39. package/dist/components/TextField/PasswordField.d.ts +4 -1
  40. package/dist/components/TextField/PasswordField.js +2 -2
  41. package/dist/components/TextField/TelField.d.ts +2 -1
  42. package/dist/components/TextField/TextField.d.ts +2 -1
  43. package/dist/components/TextField/TextareaField.d.ts +2 -1
  44. package/dist/components/index.d.ts +1 -0
  45. package/dist/components/index.js +1 -0
  46. package/dist/esm/components/Accordion/Accordion.js +6 -6
  47. package/dist/esm/components/Badge/Badge.js +6 -4
  48. package/dist/esm/components/Checkbox/Checkbox.js +5 -7
  49. package/dist/esm/components/Divider/Divider.js +15 -0
  50. package/dist/esm/components/Divider/index.js +1 -0
  51. package/dist/esm/components/Input/Input.js +6 -5
  52. package/dist/esm/components/Input/PasswordInput.js +4 -2
  53. package/dist/esm/components/Input/PasswordInput.styled.js +14 -0
  54. package/dist/esm/components/Input/PasswordVisibilityToggle.js +26 -0
  55. package/dist/esm/components/List/List.js +1 -1
  56. package/dist/esm/components/NavHeader/NavHeader.js +9 -11
  57. package/dist/esm/components/Radio/Radio.js +5 -7
  58. package/dist/esm/components/SkeletonLoading/SkeletonAnimation.js +30 -0
  59. package/dist/esm/components/SkeletonLoading/SkeletonCTA.js +3 -1
  60. package/dist/esm/components/SkeletonLoading/SkeletonCircle.js +4 -2
  61. package/dist/esm/components/SkeletonLoading/SkeletonHeading.js +3 -1
  62. package/dist/esm/components/SkeletonLoading/SkeletonText.js +2 -2
  63. package/dist/esm/components/TextField/PasswordField.js +2 -2
  64. package/dist/esm/components/index.js +1 -0
  65. package/package.json +6 -7
@@ -85,9 +85,9 @@ var StyledRadioInputDot = styled_native_1.default.View(function (_a) {
85
85
  return "\n width: ".concat(radio.dotSize, ";\n height: ").concat(radio.dotSize, ";\n margin: ").concat(dotDistance, "px;\n border-radius: ").concat(radioSize / 2, "px;\n background: ").concat(radio.dotColor, ";\n opacity: ").concat(checked ? 1 : 0, ";\n ");
86
86
  });
87
87
  var Input = function (_a) {
88
- var checked = _a.checked, invalid = _a.invalid, rest = __rest(_a, ["checked", "invalid"]);
88
+ var checked = _a.checked, invalid = _a.invalid, testID = _a.testID, rest = __rest(_a, ["checked", "invalid", "testID"]);
89
89
  return (react_1.default.createElement(StyledRadioInputWrapper, __assign({}, rest),
90
- react_1.default.createElement(StyledRadioInput, { invalid: invalid, checked: checked },
90
+ react_1.default.createElement(StyledRadioInput, { invalid: invalid, checked: checked, testID: testID },
91
91
  react_1.default.createElement(StyledRadioInputDot, { checked: checked }))));
92
92
  };
93
93
  var RadioLabelText = (0, styled_native_1.default)(LabelText_1.LabelText)(function (_a) {
@@ -100,12 +100,10 @@ var Radio = (0, react_1.forwardRef)(function (_a, ref) {
100
100
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
101
101
  value = _a.value, // "value" is needed for RadioGroup, but isn't actually used in the radio anywhere
102
102
  _b = _a.activeOpacity, // "value" is needed for RadioGroup, but isn't actually used in the radio anywhere
103
- activeOpacity = _b === void 0 ? 0.8 : _b, rest = __rest(_a, ["label", "hint", "checked", "invalid", "value", "activeOpacity"]);
104
- return (react_1.default.createElement(react_native_1.TouchableOpacity, __assign({ ref: ref, accessibilityRole: "radio", activeOpacity: activeOpacity, accessibilityState: { checked: checked },
105
- // @ts-ignore
106
- invalid: invalid }, rest),
103
+ activeOpacity = _b === void 0 ? 0.8 : _b, testID = _a.testID, rest = __rest(_a, ["label", "hint", "checked", "invalid", "value", "activeOpacity", "testID"]);
104
+ return (react_1.default.createElement(react_native_1.TouchableOpacity, __assign({ ref: ref, accessibilityRole: "radio", activeOpacity: activeOpacity, accessibilityState: { checked: checked } }, rest),
107
105
  react_1.default.createElement(StyledWrapper, null,
108
- react_1.default.createElement(Input, { checked: checked, invalid: invalid }),
106
+ react_1.default.createElement(Input, { checked: checked, invalid: invalid, testID: testID }),
109
107
  react_1.default.createElement(react_native_1.View, { style: { flexShrink: 1 } },
110
108
  react_1.default.createElement(RadioLabelText, null, label),
111
109
  hint ? react_1.default.createElement(HintText_1.HintText, null, hint) : null))));
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ export declare const SkeletonAnimation: ({ children, animation, testID, }: {
3
+ children: ReactNode;
4
+ animation?: "none" | "pulse" | undefined;
5
+ testID?: string | undefined;
6
+ }) => JSX.Element;
@@ -0,0 +1,57 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.SkeletonAnimation = void 0;
27
+ var react_1 = __importStar(require("react"));
28
+ var react_native_1 = require("react-native");
29
+ var SkeletonAnimation = function (_a) {
30
+ var children = _a.children, _b = _a.animation, animation = _b === void 0 ? 'pulse' : _b, testID = _a.testID;
31
+ var animationRef = (0, react_1.useRef)(new react_native_1.Animated.Value(0));
32
+ var animationLoop = (0, react_1.useRef)();
33
+ (0, react_1.useEffect)(function () {
34
+ animationLoop.current = react_native_1.Animated.timing(animationRef.current, {
35
+ toValue: 2,
36
+ delay: 400,
37
+ duration: 1500,
38
+ useNativeDriver: !!react_native_1.Platform.select({
39
+ web: false,
40
+ native: true,
41
+ }),
42
+ });
43
+ animationRef.current.setValue(0);
44
+ react_native_1.Animated.loop(animationLoop.current).start();
45
+ }, []);
46
+ return (react_1.default.createElement(react_native_1.View, { accessibilityRole: "none", accessibilityLabel: "loading...", accessible: false, testID: testID }, animation === 'pulse' ? (react_1.default.createElement(react_native_1.Animated.View, { style: [
47
+ {
48
+ height: '100%',
49
+ width: '100%',
50
+ opacity: animationRef.current.interpolate({
51
+ inputRange: [0.25, 1, 2],
52
+ outputRange: [1, 0.25, 1],
53
+ }),
54
+ },
55
+ ] }, children)) : (react_1.default.createElement(react_native_1.View, null, children))));
56
+ };
57
+ exports.SkeletonAnimation = SkeletonAnimation;
@@ -30,12 +30,14 @@ var react_1 = __importDefault(require("react"));
30
30
  var styled_native_1 = __importDefault(require("../../styled.native"));
31
31
  var Text_1 = require("../Text");
32
32
  var Skeleton_1 = require("./Skeleton");
33
+ var SkeletonAnimation_1 = require("./SkeletonAnimation");
33
34
  var StyledSkeletonCTA = (0, styled_native_1.default)(Skeleton_1.Skeleton)(function (_a) {
34
35
  var _b = _a.theme, colors = _b.colors, space = _b.space, size = _a.size;
35
36
  return "\n background-color: ".concat(colors.borderMuted, ";\n width: ").concat(size, ";\n height: ").concat(space[12], ";\n ");
36
37
  });
37
38
  var SkeletonCTA = function (_a) {
38
39
  var _b = _a.size, size = _b === void 0 ? '250px' : _b, rest = __rest(_a, ["size"]);
39
- return (react_1.default.createElement(StyledSkeletonCTA, __assign({ as: Text_1.P, size: size }, rest)));
40
+ return (react_1.default.createElement(SkeletonAnimation_1.SkeletonAnimation, null,
41
+ react_1.default.createElement(StyledSkeletonCTA, __assign({ as: Text_1.P, size: size }, rest))));
40
42
  };
41
43
  exports.SkeletonCTA = SkeletonCTA;
@@ -30,6 +30,7 @@ var react_1 = __importDefault(require("react"));
30
30
  var styled_native_1 = __importDefault(require("../../styled.native"));
31
31
  var utils_1 = require("../../utils");
32
32
  var Skeleton_1 = require("./Skeleton");
33
+ var SkeletonAnimation_1 = require("./SkeletonAnimation");
33
34
  var StyledSkeletonCircleWrapper = (0, styled_native_1.default)(Skeleton_1.Skeleton)(function (_a) {
34
35
  var size = _a.size;
35
36
  return "width: ".concat(size, "; max-width: 100%;");
@@ -40,7 +41,8 @@ var StyledSkeletonCircle = (0, styled_native_1.default)(Skeleton_1.Skeleton)(fun
40
41
  });
41
42
  var SkeletonCircle = function (_a) {
42
43
  var _b = _a.size, size = _b === void 0 ? '120px' : _b, rest = __rest(_a, ["size"]);
43
- return (react_1.default.createElement(StyledSkeletonCircleWrapper, __assign({ size: size }, rest),
44
- react_1.default.createElement(StyledSkeletonCircle, { size: size })));
44
+ return (react_1.default.createElement(SkeletonAnimation_1.SkeletonAnimation, null,
45
+ react_1.default.createElement(StyledSkeletonCircleWrapper, __assign({ size: size }, rest),
46
+ react_1.default.createElement(StyledSkeletonCircle, { size: size }))));
45
47
  };
46
48
  exports.SkeletonCircle = SkeletonCircle;
@@ -30,12 +30,14 @@ var react_1 = __importDefault(require("react"));
30
30
  var styled_native_1 = __importDefault(require("../../styled.native"));
31
31
  var Heading_1 = require("../Heading");
32
32
  var Skeleton_1 = require("./Skeleton");
33
+ var SkeletonAnimation_1 = require("./SkeletonAnimation");
33
34
  var StyledSkeletonHeading = (0, styled_native_1.default)(Skeleton_1.Skeleton)(function (_a) {
34
35
  var colors = _a.theme.colors, size = _a.size;
35
36
  return "\n background-color: ".concat(colors.borderMuted, ";\n width: ").concat(size, ";\n ");
36
37
  });
37
38
  var SkeletonHeading = function (_a) {
38
39
  var _b = _a.size, size = _b === void 0 ? '70%' : _b, _c = _a.headingComponent, Heading = _c === void 0 ? Heading_1.Heading3 : _c, rest = __rest(_a, ["size", "headingComponent"]);
39
- return (react_1.default.createElement(StyledSkeletonHeading, __assign({ "aria-hidden": "true", size: size, as: Heading }, rest), "\u00A0"));
40
+ return (react_1.default.createElement(SkeletonAnimation_1.SkeletonAnimation, null,
41
+ react_1.default.createElement(StyledSkeletonHeading, __assign({ "aria-hidden": "true", size: size, as: Heading }, rest), "\u00A0")));
40
42
  };
41
43
  exports.SkeletonHeading = SkeletonHeading;
@@ -27,12 +27,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
28
  exports.SkeletonText = void 0;
29
29
  var react_1 = __importDefault(require("react"));
30
- var react_native_1 = require("react-native");
31
30
  var hooks_1 = require("../../hooks");
32
31
  var styled_native_1 = __importDefault(require("../../styled.native"));
33
32
  var utils_1 = require("../../utils");
34
33
  var Text_1 = require("../Text");
35
34
  var Skeleton_1 = require("./Skeleton");
35
+ var SkeletonAnimation_1 = require("./SkeletonAnimation");
36
36
  var StyledSkeletonText = (0, styled_native_1.default)(Skeleton_1.Skeleton)(function (_a) {
37
37
  var _b = _a.theme, colors = _b.colors, space = _b.space, responsiveFontSizes = _b.responsiveFontSizes, short = _a.short, breakpoints = _a.breakpoints;
38
38
  return "\n background-color: ".concat(colors.borderMuted, ";\n margin-bottom: ").concat(space[2], ";\n ").concat((0, utils_1.responsiveStyle)('height', responsiveFontSizes.body, breakpoints), "\n\n ").concat(short ? 'width: 50%' : '', ";\n ");
@@ -44,6 +44,6 @@ var SkeletonText = function (_a) {
44
44
  for (var i = 1; i <= lines; i++) {
45
45
  generatedLines.push(react_1.default.createElement(StyledSkeletonText, { key: "line-".concat(i), short: i === lines, breakpoints: breakpoints }));
46
46
  }
47
- return (react_1.default.createElement(Text_1.P, __assign({ as: react_native_1.View }, rest), generatedLines));
47
+ return (react_1.default.createElement(Text_1.P, __assign({ as: SkeletonAnimation_1.SkeletonAnimation }, rest), generatedLines));
48
48
  };
49
49
  exports.SkeletonText = SkeletonText;
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
2
  import { TextInput as NativeTextInput } from 'react-native';
3
3
  import { FieldProps } from '../Field';
4
- export declare const CurrencyField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native").TextInputProps & {
4
+ export declare const CurrencyField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
7
  iconLeft?: (string & {}) | import("../../providers").IconName | undefined;
8
8
  iconRight?: (string & {}) | import("../../providers").IconName | undefined;
9
+ rightSlot?: React.ReactNode;
9
10
  } & {
10
11
  currency?: "GBP" | "EUR" | "AUD" | "USD" | undefined;
11
12
  } & React.RefAttributes<NativeTextInput>>;
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import { TextInput as NativeTextInput } from 'react-native';
3
3
  import { FieldProps } from '../Field';
4
- export declare const EmailField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native").TextInputProps & {
4
+ export declare const EmailField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
7
  iconLeft?: (string & {}) | import("../../providers").IconName | undefined;
8
8
  iconRight?: (string & {}) | import("../../providers").IconName | undefined;
9
+ rightSlot?: React.ReactNode;
9
10
  } & React.RefAttributes<NativeTextInput>>;
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import { TextInput as NativeTextInput } from 'react-native';
3
3
  import { FieldProps } from '../Field';
4
- export declare const NumberField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native").TextInputProps & {
4
+ export declare const NumberField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
7
  iconLeft?: (string & {}) | import("../../providers").IconName | undefined;
8
8
  iconRight?: (string & {}) | import("../../providers").IconName | undefined;
9
+ rightSlot?: React.ReactNode;
9
10
  } & React.RefAttributes<NativeTextInput>>;
@@ -1,9 +1,12 @@
1
1
  import React from 'react';
2
2
  import { TextInput as NativeTextInput } from 'react-native';
3
3
  import { FieldProps } from '../Field';
4
- export declare const PasswordField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native").TextInputProps & {
4
+ export declare const PasswordField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
7
  iconLeft?: (string & {}) | import("../../providers").IconName | undefined;
8
8
  iconRight?: (string & {}) | import("../../providers").IconName | undefined;
9
+ rightSlot?: React.ReactNode;
10
+ } & {
11
+ hasVisibilityToggle?: boolean | undefined;
9
12
  } & React.RefAttributes<NativeTextInput>>;
@@ -50,7 +50,7 @@ var react_1 = __importStar(require("react"));
50
50
  var Field_1 = require("../Field");
51
51
  var PasswordInput_1 = require("../Input/PasswordInput");
52
52
  exports.PasswordField = (0, react_1.forwardRef)(function (_a, ref) {
53
- var rest = __rest(_a, []);
53
+ var hasVisibilityToggle = _a.hasVisibilityToggle, rest = __rest(_a, ["hasVisibilityToggle"]);
54
54
  return (react_1.default.createElement(Field_1.Field, __assign({}, rest, { ref: ref }),
55
- react_1.default.createElement(PasswordInput_1.PasswordInput, null)));
55
+ react_1.default.createElement(PasswordInput_1.PasswordInput, { hasVisibilityToggle: hasVisibilityToggle })));
56
56
  });
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import { TextInput as NativeTextInput } from 'react-native';
3
3
  import { FieldProps } from '../Field';
4
- export declare const TelField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native").TextInputProps & {
4
+ export declare const TelField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
7
  iconLeft?: (string & {}) | import("../../providers").IconName | undefined;
8
8
  iconRight?: (string & {}) | import("../../providers").IconName | undefined;
9
+ rightSlot?: React.ReactNode;
9
10
  } & React.RefAttributes<NativeTextInput>>;
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import { TextInput as NativeTextInput } from 'react-native';
3
3
  import { FieldProps } from '../Field';
4
- export declare const TextField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native").TextInputProps & {
4
+ export declare const TextField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
7
  iconLeft?: (string & {}) | import("../../providers").IconName | undefined;
8
8
  iconRight?: (string & {}) | import("../../providers").IconName | undefined;
9
+ rightSlot?: React.ReactNode;
9
10
  } & React.RefAttributes<NativeTextInput>>;
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
2
  import { TextInput as NativeTextInput } from 'react-native';
3
3
  import { FieldProps } from '../Field';
4
- export declare const TextareaField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native").TextInputProps & {
4
+ export declare const TextareaField: React.ForwardRefExoticComponent<Omit<FieldProps, "children"> & import("react-native/types").TextInputProps & {
5
5
  invalid?: boolean | undefined;
6
6
  stretch?: boolean | undefined;
7
7
  iconLeft?: (string & {}) | import("../../providers").IconName | undefined;
8
8
  iconRight?: (string & {}) | import("../../providers").IconName | undefined;
9
+ rightSlot?: React.ReactNode;
9
10
  } & {
10
11
  rows?: number | undefined;
11
12
  } & React.RefAttributes<NativeTextInput>>;
@@ -6,6 +6,7 @@ export * from './CTAButton';
6
6
  export * from './CTALink';
7
7
  export * from './DateField';
8
8
  export * from './Disclosure';
9
+ export * from './Divider';
9
10
  export * from './ErrorSummaryNotification';
10
11
  export * from './Field';
11
12
  export * from './Grid';
@@ -22,6 +22,7 @@ __exportStar(require("./CTAButton"), exports);
22
22
  __exportStar(require("./CTALink"), exports);
23
23
  __exportStar(require("./DateField"), exports);
24
24
  __exportStar(require("./Disclosure"), exports);
25
+ __exportStar(require("./Divider"), exports);
25
26
  __exportStar(require("./ErrorSummaryNotification"), exports);
26
27
  __exportStar(require("./Field"), exports);
27
28
  __exportStar(require("./Grid"), exports);
@@ -24,7 +24,7 @@ var __assign = (this && this.__assign) || function () {
24
24
  };
25
25
  return __assign.apply(this, arguments);
26
26
  };
27
- import React, { useCallback, useMemo, useEffect } from 'react';
27
+ import React, { useCallback, useMemo, useEffect, useState, } from 'react';
28
28
  import { View, TouchableOpacity } from 'react-native';
29
29
  import Animated, { useSharedValue, useAnimatedStyle, useDerivedValue, withTiming, runOnUI, interpolateColor, } from 'react-native-reanimated';
30
30
  import { theme } from '../../theme';
@@ -55,7 +55,7 @@ export var Accordion = function (_a) {
55
55
  headingComponent,
56
56
  ]);
57
57
  var _d = useLayout(0), layout = _d[0], onLayout = _d[1];
58
- var open = useSharedValue(expanded);
58
+ var _e = useState(expanded), open = _e[0], setOpen = _e[1];
59
59
  var handleHeightContent = useMemo(function () { return layout.height || 100; }, [
60
60
  layout.height,
61
61
  ]);
@@ -76,19 +76,19 @@ export var Accordion = function (_a) {
76
76
  }
77
77
  })();
78
78
  }, [handleHeightContent, size]);
79
- var progress = useDerivedValue(function () { return withTiming(open.value ? 1 : 0); });
79
+ var progress = useDerivedValue(function () { return withTiming(open ? 1 : 0); });
80
80
  var style = useAnimatedStyle(function () { return ({
81
81
  height: size.value * progress.value + 1,
82
82
  }); });
83
83
  var toggleOpen = useCallback(function () {
84
- onToggle === null || onToggle === void 0 ? void 0 : onToggle(!open.value);
84
+ onToggle === null || onToggle === void 0 ? void 0 : onToggle(!open);
85
85
  if (size.value === 0) {
86
86
  runOnUI(function () {
87
87
  'worklet';
88
88
  size.value = handleHeightContent;
89
89
  })();
90
90
  }
91
- open.value = !open.value;
91
+ setOpen(function (o) { return !o; });
92
92
  }, [handleHeightContent, open, size]);
93
93
  var containerAnimatedStyle = useMemo(function () { return [styles.content, style]; }, [style]);
94
94
  var headerStyle = useAnimatedStyle(function () { return ({
@@ -103,7 +103,7 @@ export var Accordion = function (_a) {
103
103
  first ? styles.topItem : null,
104
104
  last ? styles.bottomItem : null,
105
105
  ] },
106
- React.createElement(TouchableOpacity, { accessibilityState: { expanded: expanded }, onPress: toggleOpen, style: styles.accordionHeader },
106
+ React.createElement(TouchableOpacity, { accessibilityState: { expanded: open }, onPress: toggleOpen, style: styles.accordionHeader, testID: "accordionTitle" },
107
107
  React.createElement(AnimatedHeading, { style: [headerStyle, styles.accordionHeaderText] }, title),
108
108
  React.createElement(AccordionIcon, { animationTiming: progress })),
109
109
  React.createElement(Animated.View, { style: containerAnimatedStyle },
@@ -29,16 +29,18 @@ import { useBreakpoint } from '../../hooks';
29
29
  import styled, { css } from '../../styled.native';
30
30
  import { calculateLineHeight } from '../../theme';
31
31
  var StyledBadge = styled.View(function (_a) {
32
- var badge = _a.theme.badge, _b = _a.variant, variant = _b === void 0 ? 'default' : _b;
32
+ var badge = _a.theme.badge, _b = _a.variant, variant = _b === void 0 ? 'default' : _b, _c = _a.inverted, inverted = _c === void 0 ? false : _c;
33
33
  // @ts-ignore to support additional palettes.
34
34
  var currentVariant = badge.variants[variant];
35
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 0 ", ";\n border-radius: ", ";\n background-color: ", ";\n align-self: flex-start;\n "], ["\n padding: 0 ", ";\n border-radius: ", ";\n background-color: ", ";\n align-self: flex-start;\n "])), badge.paddingHorizontal, badge.borderRadius, currentVariant.background);
35
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 0 ", ";\n border-radius: ", ";\n background-color: ", ";\n align-self: flex-start;\n "], ["\n padding: 0 ", ";\n border-radius: ", ";\n background-color: ", ";\n align-self: flex-start;\n "])), badge.paddingHorizontal, badge.borderRadius, inverted
36
+ ? currentVariant.foreground
37
+ : currentVariant.background);
36
38
  });
37
39
  var StyledBadgeText = styled.Text(function (_a) {
38
- var badge = _a.theme.badge, _b = _a.variant, variant = _b === void 0 ? 'default' : _b;
40
+ var badge = _a.theme.badge, _b = _a.variant, variant = _b === void 0 ? 'default' : _b, _c = _a.inverted, inverted = _c === void 0 ? false : _c;
39
41
  // @ts-ignore to support additional palettes.
40
42
  var currentVariant = badge.variants[variant];
41
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "], ["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "])), badge.fontFamily, badge.fontWeight, calculateLineHeight(badge.fontSize[1], badge.lineHeight), currentVariant.foreground, badge.fontSize[1]);
43
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "], ["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "])), badge.fontFamily, badge.fontWeight, calculateLineHeight(badge.fontSize[1], badge.lineHeight), inverted ? currentVariant.background : currentVariant.foreground, badge.fontSize[1]);
42
44
  });
43
45
  export var Badge = function (_a) {
44
46
  var children = _a.children, variant = _a.variant, rest = __rest(_a, ["children", "variant"]);
@@ -64,9 +64,9 @@ var StyledCheckboxInputCheck = styled(CheckboxCheck)(function (_a) {
64
64
  return "\n margin-top: ".concat(checkDistance, "px;\n margin-left: ").concat(checkDistance, "px;\n opacity: ").concat(checked ? 1 : 0, ";\n ");
65
65
  });
66
66
  var Input = function (_a) {
67
- var checked = _a.checked, invalid = _a.invalid, rest = __rest(_a, ["checked", "invalid"]);
67
+ var checked = _a.checked, invalid = _a.invalid, testID = _a.testID, rest = __rest(_a, ["checked", "invalid", "testID"]);
68
68
  return (React.createElement(StyledCheckboxInputWrapper, __assign({}, rest),
69
- React.createElement(StyledCheckboxInput, { invalid: invalid, checked: checked },
69
+ React.createElement(StyledCheckboxInput, { invalid: invalid, checked: checked, testID: testID },
70
70
  React.createElement(StyledCheckboxInputCheck, { checked: checked }))));
71
71
  };
72
72
  var CheckLabelText = styled(LabelText)(function (_a) {
@@ -75,16 +75,14 @@ var CheckLabelText = styled(LabelText)(function (_a) {
75
75
  });
76
76
  var StyledWrapper = styled.View(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: row;\n"], ["\n flex-direction: row;\n"])));
77
77
  var Checkbox = forwardRef(function (_a, ref) {
78
- var label = _a.label, hint = _a.hint, error = _a.error, checked = _a.checked, optional = _a.optional, invalid = _a.invalid, _b = _a.activeOpacity, activeOpacity = _b === void 0 ? 0.8 : _b, rest = __rest(_a, ["label", "hint", "error", "checked", "optional", "invalid", "activeOpacity"]);
78
+ var label = _a.label, hint = _a.hint, error = _a.error, checked = _a.checked, optional = _a.optional, invalid = _a.invalid, _b = _a.activeOpacity, activeOpacity = _b === void 0 ? 0.8 : _b, testID = _a.testID, rest = __rest(_a, ["label", "hint", "error", "checked", "optional", "invalid", "activeOpacity", "testID"]);
79
79
  var hasError = !!error;
80
80
  return (React.createElement(FormGroup, { error: hasError },
81
81
  React.createElement(Stack, { spaceBetween: 1 },
82
82
  error ? React.createElement(ErrorText, null, error) : null,
83
- React.createElement(TouchableOpacity, __assign({ ref: ref, accessibilityRole: "checkbox", activeOpacity: activeOpacity, accessibilityState: { checked: checked },
84
- // @ts-ignore
85
- invalid: hasError || invalid }, rest),
83
+ React.createElement(TouchableOpacity, __assign({ ref: ref, accessibilityRole: "checkbox", activeOpacity: activeOpacity, accessibilityState: { checked: checked } }, rest),
86
84
  React.createElement(StyledWrapper, null,
87
- React.createElement(Input, { checked: checked, invalid: hasError || invalid }),
85
+ React.createElement(Input, { checked: checked, invalid: hasError || invalid, testID: testID }),
88
86
  React.createElement(View, { style: { flexShrink: 1 } },
89
87
  React.createElement(CheckLabelText, null,
90
88
  label,
@@ -0,0 +1,15 @@
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 React from 'react';
6
+ import styled, { css } from '../../styled.native';
7
+ var StyledDivider = styled.View(function (_a) {
8
+ var colors = _a.theme.colors, _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' ? colors.primaryContrast : '#ECE5DD', width);
10
+ });
11
+ export var Divider = function (_a) {
12
+ var type = _a.type, width = _a.width;
13
+ return React.createElement(StyledDivider, { type: type, width: width });
14
+ };
15
+ var templateObject_1;
@@ -0,0 +1 @@
1
+ export { Divider } from './Divider';
@@ -36,13 +36,13 @@ var StyledIcon = styled(Icon)(function (_a) {
36
36
  return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n width: ", ";\n z-index: 1;\n top: ", "px;\n ", ";\n ", ";\n "], ["\n position: absolute;\n width: ", ";\n z-index: 1;\n top: ", "px;\n ", ";\n ", ";\n "])), input.icon.size, distance, side === 'left' ? "left: ".concat(distance, "px") : '', side === 'right' ? "right: ".concat(distance, "px") : '');
37
37
  });
38
38
  var Input = forwardRef(function (_a, ref) {
39
- var onFocus = _a.onFocus, onBlur = _a.onBlur, style = _a.style, iconLeft = _a.iconLeft, iconRight = _a.iconRight, rest = __rest(_a, ["onFocus", "onBlur", "style", "iconLeft", "iconRight"]);
39
+ 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"]);
40
40
  var _b = useState(false), focused = _b[0], setFocused = _b[1];
41
41
  var breakpoints = useBreakpoint();
42
42
  var input = useContext(ThemeContext).input;
43
43
  return (React.createElement(InputWrapper, { focused: focused },
44
44
  iconLeft ? (React.createElement(StyledIcon, { name: iconLeft, size: pxToNumber(input.icon.size), focused: focused, pointerEvents: "none", side: "left" })) : null,
45
- React.createElement(StyledInput, __assign({}, rest, breakpoints, { iconLeft: !!iconLeft, iconRight: !!iconRight, style: style,
45
+ React.createElement(StyledInput, __assign({}, rest, breakpoints, { iconLeft: !!iconLeft, iconRight: !!iconRight, hasRightSlot: !!rightSlot, style: style,
46
46
  // @ts-ignore
47
47
  ref: ref, onFocus: function (event) {
48
48
  setFocused(true);
@@ -55,7 +55,8 @@ var Input = forwardRef(function (_a, ref) {
55
55
  onBlur(event);
56
56
  }
57
57
  } })),
58
- iconRight ? (React.createElement(StyledIcon, { name: iconRight, size: pxToNumber(input.icon.size), focused: focused, pointerEvents: "none", side: "right" })) : null));
58
+ iconRight && !rightSlot ? (React.createElement(StyledIcon, { name: iconRight, size: pxToNumber(input.icon.size), focused: focused, pointerEvents: "none", side: "right" })) : null,
59
+ rightSlot));
59
60
  });
60
61
  var InputWrapper = styled.View(function (_a) {
61
62
  var _b = _a.theme, input = _b.input, focusRing = _b.focusRing, focused = _a.focused;
@@ -65,12 +66,12 @@ var InputWrapper = styled.View(function (_a) {
65
66
  : null);
66
67
  });
67
68
  var StyledInput = styled.TextInput(function (_a) {
68
- var input = _a.theme.input, invalid = _a.invalid, smallAndUp = _a.smallAndUp, iconLeft = _a.iconLeft, iconRight = _a.iconRight;
69
+ var input = _a.theme.input, invalid = _a.invalid, smallAndUp = _a.smallAndUp, iconLeft = _a.iconLeft, iconRight = _a.iconRight, hasRightSlot = _a.hasRightSlot;
69
70
  var fontSize = smallAndUp ? input.fontSize[1] : input.fontSize[0];
70
71
  var errorStyles = invalid
71
72
  ? "\n border-width: ".concat(input.error.borderWidth, ";\n border-color: ").concat(input.error.color, ";\n ")
72
73
  : '';
73
- return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-family: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n height: ", ";\n line-height: 18px; /* Corrects for responsive line height in fixed height input */\n border: ", " solid ", ";\n background: ", ";\n border-radius: ", ";\n padding: ", ";\n flex: 1;\n\n ", "\n ", "\n\n ", "\n "], ["\n font-family: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n height: ", ";\n line-height: 18px; /* Corrects for responsive line height in fixed height input */\n border: ", " solid ", ";\n background: ", ";\n border-radius: ", ";\n padding: ", ";\n flex: 1;\n\n ", "\n ", "\n\n ", "\n "])), input.fontFamily, input.fontWeight, input.color, fontSize, input.height, input.borderWidth, input.borderColor, input.background, input.borderRadius, input.padding, iconLeft ? "padding-left: ".concat(input.height, ";") : '', iconRight ? "padding-right: ".concat(input.height, ";") : '', errorStyles);
74
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-family: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n height: ", ";\n line-height: 18px; /* Corrects for responsive line height in fixed height input */\n border: ", " solid ", ";\n background: ", ";\n border-radius: ", ";\n padding: ", ";\n flex: 1;\n\n ", "\n ", "\n\n ", "\n "], ["\n font-family: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n height: ", ";\n line-height: 18px; /* Corrects for responsive line height in fixed height input */\n border: ", " solid ", ";\n background: ", ";\n border-radius: ", ";\n padding: ", ";\n flex: 1;\n\n ", "\n ", "\n\n ", "\n "])), input.fontFamily, input.fontWeight, input.color, fontSize, input.height, input.borderWidth, input.borderColor, input.background, input.borderRadius, input.padding, iconLeft ? "padding-left: ".concat(input.height, ";") : '', iconRight || hasRightSlot ? "padding-right: ".concat(input.height, ";") : '', errorStyles);
74
75
  });
75
76
  export { Input };
76
77
  var templateObject_1, templateObject_2, templateObject_3;
@@ -22,8 +22,10 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import React, { forwardRef } from 'react';
24
24
  import { Input } from './Input';
25
+ import { PasswordVisibilityToggle, useTogglePasswordVisibility, } from './PasswordVisibilityToggle';
25
26
  var PasswordInput = forwardRef(function (_a, ref) {
26
- var _b = _a.secureTextEntry, secureTextEntry = _b === void 0 ? true : _b, props = __rest(_a, ["secureTextEntry"]);
27
- return (React.createElement(Input, __assign({}, props, { keyboardType: "default", autoCapitalize: "none", autoCorrect: false, secureTextEntry: secureTextEntry, ref: ref })));
27
+ var props = __rest(_a, []);
28
+ var _b = useTogglePasswordVisibility(), isPasswordVisible = _b.isPasswordVisible, handlePasswordVisibility = _b.handlePasswordVisibility;
29
+ return (React.createElement(Input, __assign({}, props, { rightSlot: props.hasVisibilityToggle ? (React.createElement(PasswordVisibilityToggle, { iconName: isPasswordVisible ? 'hide' : 'show', visibilityToggleLabel: isPasswordVisible ? 'Hide password' : 'Show password', handlePasswordVisibility: handlePasswordVisibility })) : null, keyboardType: "default", autoCapitalize: "none", autoCorrect: false, blurOnSubmit: false, secureTextEntry: !isPasswordVisible, ref: ref })));
28
30
  });
29
31
  export { PasswordInput };
@@ -0,0 +1,14 @@
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 { Pressable } from 'react-native';
6
+ import styled, { css } from '../../styled.native';
7
+ import { pxToNumber } from '../../utils';
8
+ export var StyledPressable = styled(Pressable)(function (_a) {
9
+ var _b = _a.theme, input = _b.input, focusRing = _b.focusRing, focused = _a.focused;
10
+ var distance = (pxToNumber(input.height) - pxToNumber(input.icon.size)) / 2 +
11
+ (focused ? pxToNumber(focusRing.distance) : 0);
12
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n position: absolute;\n width: ", ";\n z-index: 1;\n top: ", "px;\n right: ", "px;\n "], ["\n display: flex;\n align-items: center;\n position: absolute;\n width: ", ";\n z-index: 1;\n top: ", "px;\n right: ", "px;\n "])), input.icon.size, distance, distance);
13
+ });
14
+ var templateObject_1;
@@ -0,0 +1,26 @@
1
+ import React, { useContext, useState } from 'react';
2
+ import { ThemeContext } from '../../styled.native';
3
+ import { pxToNumber } from '../../utils';
4
+ import { Icon } from '../Icon';
5
+ import { StyledPressable } from './PasswordInput.styled';
6
+ export var useTogglePasswordVisibility = function () {
7
+ var _a = useState(false), isPasswordVisible = _a[0], setIsPasswordVisible = _a[1];
8
+ var handlePasswordVisibility = function () {
9
+ setIsPasswordVisible(!isPasswordVisible);
10
+ };
11
+ return {
12
+ isPasswordVisible: isPasswordVisible,
13
+ handlePasswordVisibility: handlePasswordVisibility,
14
+ };
15
+ };
16
+ export var PasswordVisibilityToggle = function (_a) {
17
+ var iconName = _a.iconName, visibilityToggleLabel = _a.visibilityToggleLabel, handlePasswordVisibility = _a.handlePasswordVisibility;
18
+ var input = useContext(ThemeContext).input;
19
+ var _b = useState(false), focused = _b[0], setFocused = _b[1];
20
+ return (React.createElement(StyledPressable, { testID: "password-input-visibility-toggle", focused: focused, accessibilityRole: "button", accessibilityLabel: visibilityToggleLabel, onPress: handlePasswordVisibility, hitSlop: pxToNumber(input.icon.size), onFocus: function () {
21
+ setFocused(true);
22
+ }, onBlur: function () {
23
+ setFocused(false);
24
+ } },
25
+ React.createElement(Icon, { name: iconName, size: pxToNumber(input.icon.size), pointerEvents: "none" })));
26
+ };
@@ -48,7 +48,7 @@ var StyledBullet = styled.Text(function (_a) {
48
48
  : list.listItem.lineHeight[0];
49
49
  return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "])), text.fontFamily, lineHeight, text.fontWeight, text.color, fontSize, list.listItem.bulletGap, space[4]);
50
50
  });
51
- var StyledUlItem = styled.View(function () { return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n align-items: top;\n justify-content: center;\n "], ["\n flex-direction: row;\n align-items: top;\n justify-content: center;\n "]))); });
51
+ var StyledUlItem = styled.View(function () { return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n align-items: flex-start;\n justify-content: center;\n "], ["\n flex-direction: row;\n align-items: flex-start;\n justify-content: center;\n "]))); });
52
52
  var Bullet = styledComponentWithBreakpoints(StyledBullet);
53
53
  var ListBulletItem = function (_a) {
54
54
  var children = _a.children, _b = _a.showBullets, showBullets = _b === void 0 ? true : _b;