@ovotech/element-native 2.0.4 → 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.
- package/dist/components/Accordion/Accordion.js +5 -5
- package/dist/components/Accordion/types.d.ts +1 -0
- package/dist/components/Badge/Badge.d.ts +1 -0
- package/dist/components/Badge/Badge.js +6 -4
- package/dist/components/CTALink/CTALink.d.ts +3 -4
- package/dist/components/Checkbox/Checkbox.js +5 -7
- package/dist/components/Divider/Divider.d.ts +5 -0
- package/dist/components/Divider/Divider.js +45 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/Divider/index.js +5 -0
- package/dist/components/Grid/Col.d.ts +1 -1
- package/dist/components/Input/CurrencyInput.d.ts +2 -1
- package/dist/components/Input/EmailInput.d.ts +2 -1
- package/dist/components/Input/Input.d.ts +3 -1
- package/dist/components/Input/Input.js +6 -5
- package/dist/components/Input/NumberInput.d.ts +2 -1
- package/dist/components/Input/PasswordInput.d.ts +4 -1
- package/dist/components/Input/PasswordInput.js +4 -2
- package/dist/components/Input/PasswordInput.styled.d.ts +4 -0
- package/dist/components/Input/PasswordInput.styled.js +40 -0
- package/dist/components/Input/PasswordVisibilityToggle.d.ts +11 -0
- package/dist/components/Input/PasswordVisibilityToggle.js +54 -0
- package/dist/components/Input/TelInput.d.ts +2 -1
- package/dist/components/Input/TextInput.d.ts +2 -1
- package/dist/components/Input/TextareaInput.d.ts +2 -1
- package/dist/components/NavHeader/NavHeader.d.ts +1 -0
- package/dist/components/NavHeader/NavHeader.js +8 -10
- package/dist/components/Radio/Radio.js +5 -7
- package/dist/components/SkeletonLoading/SkeletonAnimation.d.ts +6 -0
- package/dist/components/SkeletonLoading/SkeletonAnimation.js +57 -0
- package/dist/components/SkeletonLoading/SkeletonCTA.js +3 -1
- package/dist/components/SkeletonLoading/SkeletonCircle.js +4 -2
- package/dist/components/SkeletonLoading/SkeletonHeading.js +3 -1
- package/dist/components/SkeletonLoading/SkeletonText.js +2 -2
- package/dist/components/TextField/CurrencyField.d.ts +2 -1
- package/dist/components/TextField/EmailField.d.ts +2 -1
- package/dist/components/TextField/NumberField.d.ts +2 -1
- package/dist/components/TextField/PasswordField.d.ts +4 -1
- package/dist/components/TextField/PasswordField.js +2 -2
- package/dist/components/TextField/TelField.d.ts +2 -1
- package/dist/components/TextField/TextField.d.ts +2 -1
- package/dist/components/TextField/TextareaField.d.ts +2 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/esm/components/Accordion/Accordion.js +6 -6
- package/dist/esm/components/Badge/Badge.js +6 -4
- package/dist/esm/components/Checkbox/Checkbox.js +5 -7
- package/dist/esm/components/Divider/Divider.js +15 -0
- package/dist/esm/components/Divider/index.js +1 -0
- package/dist/esm/components/Input/Input.js +6 -5
- package/dist/esm/components/Input/PasswordInput.js +4 -2
- package/dist/esm/components/Input/PasswordInput.styled.js +14 -0
- package/dist/esm/components/Input/PasswordVisibilityToggle.js +26 -0
- package/dist/esm/components/NavHeader/NavHeader.js +9 -11
- package/dist/esm/components/Radio/Radio.js +5 -7
- package/dist/esm/components/SkeletonLoading/SkeletonAnimation.js +30 -0
- package/dist/esm/components/SkeletonLoading/SkeletonCTA.js +3 -1
- package/dist/esm/components/SkeletonLoading/SkeletonCircle.js +4 -2
- package/dist/esm/components/SkeletonLoading/SkeletonHeading.js +3 -1
- package/dist/esm/components/SkeletonLoading/SkeletonText.js +2 -2
- package/dist/esm/components/TextField/PasswordField.js +2 -2
- package/dist/esm/components/index.js +1 -0
- package/package.json +6 -7
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { View, Animated, Platform } from 'react-native';
|
|
3
|
+
export var SkeletonAnimation = function (_a) {
|
|
4
|
+
var children = _a.children, _b = _a.animation, animation = _b === void 0 ? 'pulse' : _b, testID = _a.testID;
|
|
5
|
+
var animationRef = useRef(new Animated.Value(0));
|
|
6
|
+
var animationLoop = useRef();
|
|
7
|
+
useEffect(function () {
|
|
8
|
+
animationLoop.current = Animated.timing(animationRef.current, {
|
|
9
|
+
toValue: 2,
|
|
10
|
+
delay: 400,
|
|
11
|
+
duration: 1500,
|
|
12
|
+
useNativeDriver: !!Platform.select({
|
|
13
|
+
web: false,
|
|
14
|
+
native: true,
|
|
15
|
+
}),
|
|
16
|
+
});
|
|
17
|
+
animationRef.current.setValue(0);
|
|
18
|
+
Animated.loop(animationLoop.current).start();
|
|
19
|
+
}, []);
|
|
20
|
+
return (React.createElement(View, { accessibilityRole: "none", accessibilityLabel: "loading...", accessible: false, testID: testID }, animation === 'pulse' ? (React.createElement(Animated.View, { style: [
|
|
21
|
+
{
|
|
22
|
+
height: '100%',
|
|
23
|
+
width: '100%',
|
|
24
|
+
opacity: animationRef.current.interpolate({
|
|
25
|
+
inputRange: [0.25, 1, 2],
|
|
26
|
+
outputRange: [1, 0.25, 1],
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
] }, children)) : (React.createElement(View, null, children))));
|
|
30
|
+
};
|
|
@@ -24,11 +24,13 @@ import React from 'react';
|
|
|
24
24
|
import styled from '../../styled.native';
|
|
25
25
|
import { P } from '../Text';
|
|
26
26
|
import { Skeleton } from './Skeleton';
|
|
27
|
+
import { SkeletonAnimation } from './SkeletonAnimation';
|
|
27
28
|
var StyledSkeletonCTA = styled(Skeleton)(function (_a) {
|
|
28
29
|
var _b = _a.theme, colors = _b.colors, space = _b.space, size = _a.size;
|
|
29
30
|
return "\n background-color: ".concat(colors.borderMuted, ";\n width: ").concat(size, ";\n height: ").concat(space[12], ";\n ");
|
|
30
31
|
});
|
|
31
32
|
export var SkeletonCTA = function (_a) {
|
|
32
33
|
var _b = _a.size, size = _b === void 0 ? '250px' : _b, rest = __rest(_a, ["size"]);
|
|
33
|
-
return (React.createElement(
|
|
34
|
+
return (React.createElement(SkeletonAnimation, null,
|
|
35
|
+
React.createElement(StyledSkeletonCTA, __assign({ as: P, size: size }, rest))));
|
|
34
36
|
};
|
|
@@ -24,6 +24,7 @@ import React from 'react';
|
|
|
24
24
|
import styled from '../../styled.native';
|
|
25
25
|
import { pxToNumber } from '../../utils';
|
|
26
26
|
import { Skeleton } from './Skeleton';
|
|
27
|
+
import { SkeletonAnimation } from './SkeletonAnimation';
|
|
27
28
|
var StyledSkeletonCircleWrapper = styled(Skeleton)(function (_a) {
|
|
28
29
|
var size = _a.size;
|
|
29
30
|
return "width: ".concat(size, "; max-width: 100%;");
|
|
@@ -34,6 +35,7 @@ var StyledSkeletonCircle = styled(Skeleton)(function (_a) {
|
|
|
34
35
|
});
|
|
35
36
|
export var SkeletonCircle = function (_a) {
|
|
36
37
|
var _b = _a.size, size = _b === void 0 ? '120px' : _b, rest = __rest(_a, ["size"]);
|
|
37
|
-
return (React.createElement(
|
|
38
|
-
React.createElement(
|
|
38
|
+
return (React.createElement(SkeletonAnimation, null,
|
|
39
|
+
React.createElement(StyledSkeletonCircleWrapper, __assign({ size: size }, rest),
|
|
40
|
+
React.createElement(StyledSkeletonCircle, { size: size }))));
|
|
39
41
|
};
|
|
@@ -24,11 +24,13 @@ import React from 'react';
|
|
|
24
24
|
import styled from '../../styled.native';
|
|
25
25
|
import { Heading3 } from '../Heading';
|
|
26
26
|
import { Skeleton } from './Skeleton';
|
|
27
|
+
import { SkeletonAnimation } from './SkeletonAnimation';
|
|
27
28
|
var StyledSkeletonHeading = styled(Skeleton)(function (_a) {
|
|
28
29
|
var colors = _a.theme.colors, size = _a.size;
|
|
29
30
|
return "\n background-color: ".concat(colors.borderMuted, ";\n width: ").concat(size, ";\n ");
|
|
30
31
|
});
|
|
31
32
|
export var SkeletonHeading = function (_a) {
|
|
32
33
|
var _b = _a.size, size = _b === void 0 ? '70%' : _b, _c = _a.headingComponent, Heading = _c === void 0 ? Heading3 : _c, rest = __rest(_a, ["size", "headingComponent"]);
|
|
33
|
-
return (React.createElement(
|
|
34
|
+
return (React.createElement(SkeletonAnimation, null,
|
|
35
|
+
React.createElement(StyledSkeletonHeading, __assign({ "aria-hidden": "true", size: size, as: Heading }, rest), "\u00A0")));
|
|
34
36
|
};
|
|
@@ -21,12 +21,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React from 'react';
|
|
24
|
-
import { View } from 'react-native';
|
|
25
24
|
import { useBreakpoint } from '../../hooks';
|
|
26
25
|
import styled from '../../styled.native';
|
|
27
26
|
import { responsiveStyle } from '../../utils';
|
|
28
27
|
import { P } from '../Text';
|
|
29
28
|
import { Skeleton } from './Skeleton';
|
|
29
|
+
import { SkeletonAnimation } from './SkeletonAnimation';
|
|
30
30
|
var StyledSkeletonText = styled(Skeleton)(function (_a) {
|
|
31
31
|
var _b = _a.theme, colors = _b.colors, space = _b.space, responsiveFontSizes = _b.responsiveFontSizes, short = _a.short, breakpoints = _a.breakpoints;
|
|
32
32
|
return "\n background-color: ".concat(colors.borderMuted, ";\n margin-bottom: ").concat(space[2], ";\n ").concat(responsiveStyle('height', responsiveFontSizes.body, breakpoints), "\n\n ").concat(short ? 'width: 50%' : '', ";\n ");
|
|
@@ -38,5 +38,5 @@ export var SkeletonText = function (_a) {
|
|
|
38
38
|
for (var i = 1; i <= lines; i++) {
|
|
39
39
|
generatedLines.push(React.createElement(StyledSkeletonText, { key: "line-".concat(i), short: i === lines, breakpoints: breakpoints }));
|
|
40
40
|
}
|
|
41
|
-
return (React.createElement(P, __assign({ as:
|
|
41
|
+
return (React.createElement(P, __assign({ as: SkeletonAnimation }, rest), generatedLines));
|
|
42
42
|
};
|
|
@@ -24,7 +24,7 @@ import React, { forwardRef } from 'react';
|
|
|
24
24
|
import { Field } from '../Field';
|
|
25
25
|
import { PasswordInput } from '../Input/PasswordInput';
|
|
26
26
|
export var PasswordField = forwardRef(function (_a, ref) {
|
|
27
|
-
var rest = __rest(_a, []);
|
|
27
|
+
var hasVisibilityToggle = _a.hasVisibilityToggle, rest = __rest(_a, ["hasVisibilityToggle"]);
|
|
28
28
|
return (React.createElement(Field, __assign({}, rest, { ref: ref }),
|
|
29
|
-
React.createElement(PasswordInput,
|
|
29
|
+
React.createElement(PasswordInput, { hasVisibilityToggle: hasVisibilityToggle })));
|
|
30
30
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ovotech/element-native",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,14 +14,13 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@babel/core": "^7.11.5",
|
|
17
|
-
"@storybook/react-native": "^5.3.25",
|
|
18
17
|
"@testing-library/dom": "^8.20.0",
|
|
19
18
|
"@testing-library/react": "^13.4.0",
|
|
20
19
|
"@testing-library/react-native": "^11.5.2",
|
|
21
20
|
"@testing-library/user-event": "^14.4.3",
|
|
22
|
-
"@types/jest": "^
|
|
21
|
+
"@types/jest": "^28.1.1",
|
|
23
22
|
"@types/react": "18.0.24",
|
|
24
|
-
"@types/react-native": "^0.
|
|
23
|
+
"@types/react-native": "^0.72.0",
|
|
25
24
|
"@types/react-router-dom": "^5.1.5",
|
|
26
25
|
"@types/styled-components": "^5.1.3",
|
|
27
26
|
"@types/styled-components-react-native": "^5.1.1",
|
|
@@ -29,10 +28,10 @@
|
|
|
29
28
|
"babel-plugin-require-context-hook": "^1.0.0",
|
|
30
29
|
"jest": "^28.1.1",
|
|
31
30
|
"jest-styled-components": "^7.0.3",
|
|
32
|
-
"metro-react-native-babel-preset": "^0.
|
|
31
|
+
"metro-react-native-babel-preset": "^0.76.0",
|
|
33
32
|
"react": "18.2.0",
|
|
34
33
|
"react-is": "^16.13.0",
|
|
35
|
-
"react-native": "0.
|
|
34
|
+
"react-native": "0.71.8",
|
|
36
35
|
"react-native-reanimated": "^2.10.0",
|
|
37
36
|
"react-native-svg": "9.2.4",
|
|
38
37
|
"react-router-dom": "^5.1.2",
|
|
@@ -44,7 +43,7 @@
|
|
|
44
43
|
},
|
|
45
44
|
"peerDependencies": {
|
|
46
45
|
"react": "^16.9.0 || ^17.0.0",
|
|
47
|
-
"react-native": "^0.63.3",
|
|
46
|
+
"react-native": "^0.63.3 || ^0.71.0",
|
|
48
47
|
"react-native-reanimated": "^2.10.0",
|
|
49
48
|
"react-native-svg": "^13.5.0",
|
|
50
49
|
"styled-components": "^5.1.3"
|