@fluentui-react-native/drawer 0.4.19 → 0.5.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/CHANGELOG.md +40 -0
- package/lib/Drawer.d.ts +7 -2
- package/lib/Drawer.d.ts.map +1 -1
- package/lib/Drawer.js +39 -27
- package/lib/Drawer.js.map +1 -1
- package/lib/Drawer.styling.d.ts +1 -1
- package/lib/Drawer.styling.js +51 -42
- package/lib/Drawer.types.d.ts +179 -168
- package/lib/Drawer.types.d.ts.map +1 -1
- package/lib/Drawer.types.js +1 -1
- package/lib/Drawer.types.js.map +1 -1
- package/lib/DrawerTokens.d.ts +1 -1
- package/lib/DrawerTokens.js +32 -32
- package/lib/DrawerTokens.js.map +1 -1
- package/lib/__tests__/Drawer.test.d.ts +1 -1
- package/lib/__tests__/Drawer.test.js +12 -8
- package/lib/__tests__/Drawer.test.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/useDrawer.d.ts +1 -1
- package/lib/useDrawer.d.ts.map +1 -1
- package/lib/useDrawer.js +72 -67
- package/lib/useDrawer.js.map +1 -1
- package/lib-commonjs/Drawer.d.ts +7 -2
- package/lib-commonjs/Drawer.d.ts.map +1 -1
- package/lib-commonjs/Drawer.js +48 -33
- package/lib-commonjs/Drawer.js.map +1 -1
- package/lib-commonjs/Drawer.styling.d.ts +1 -1
- package/lib-commonjs/Drawer.styling.js +56 -47
- package/lib-commonjs/Drawer.types.d.ts +179 -168
- package/lib-commonjs/Drawer.types.d.ts.map +1 -1
- package/lib-commonjs/Drawer.types.js +3 -3
- package/lib-commonjs/Drawer.types.js.map +1 -1
- package/lib-commonjs/DrawerTokens.d.ts +1 -1
- package/lib-commonjs/DrawerTokens.js +35 -35
- package/lib-commonjs/DrawerTokens.js.map +1 -1
- package/lib-commonjs/__tests__/Drawer.test.d.ts +1 -1
- package/lib-commonjs/__tests__/Drawer.test.js +66 -35
- package/lib-commonjs/__tests__/Drawer.test.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -1
- package/lib-commonjs/index.js +17 -7
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/useDrawer.d.ts +1 -1
- package/lib-commonjs/useDrawer.d.ts.map +1 -1
- package/lib-commonjs/useDrawer.js +76 -71
- package/lib-commonjs/useDrawer.js.map +1 -1
- package/package.json +61 -60
- package/src/Drawer.tsx +2 -3
- package/src/Drawer.types.ts +4 -3
- package/src/__tests__/Drawer.test.tsx +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDrawer.d.ts","sourceRoot":"","sources":["../src/useDrawer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI9D,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"useDrawer.d.ts","sourceRoot":"","sources":["../src/useDrawer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI9D,eAAO,MAAM,SAAS,oCAgFrB,CAAC"}
|
|
@@ -1,76 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
3
|
exports.useDrawer = void 0;
|
|
4
|
-
const react_1 = require(
|
|
5
|
-
const react_native_1 = require(
|
|
4
|
+
const react_1 = require('react');
|
|
5
|
+
const react_native_1 = require('react-native');
|
|
6
6
|
const { height, width } = react_native_1.Dimensions.get('window');
|
|
7
7
|
const useDrawer = (props) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
8
|
+
const { onBlur, onFocus, accessibilityLabel, open, drawerPosition = 'left', showHandle = true, children, ...rest } = props;
|
|
9
|
+
const animatedValue = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
|
|
10
|
+
const [internalOpen, setInternalOpen] = (0, react_1.useState)(open);
|
|
11
|
+
const [isFirstOpen, setIsFirstOpen] = (0, react_1.useState)(true);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
if (open) {
|
|
14
|
+
setInternalOpen(true);
|
|
15
|
+
react_native_1.Animated.timing(animatedValue, {
|
|
16
|
+
toValue: 1,
|
|
17
|
+
duration: 300,
|
|
18
|
+
useNativeDriver: true,
|
|
19
|
+
}).start();
|
|
20
|
+
} else {
|
|
21
|
+
if (isFirstOpen) {
|
|
22
|
+
setIsFirstOpen(false);
|
|
23
|
+
} else {
|
|
24
|
+
react_native_1.Animated.parallel([
|
|
25
|
+
react_native_1.Animated.timing(animatedValue, {
|
|
26
|
+
toValue: 0,
|
|
27
|
+
duration: 300,
|
|
28
|
+
useNativeDriver: true,
|
|
29
|
+
}),
|
|
30
|
+
]).start(() => {
|
|
31
|
+
setInternalOpen(false);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, [animatedValue, open]);
|
|
36
|
+
const onClose = (0, react_1.useCallback)(
|
|
37
|
+
(e) => {
|
|
38
|
+
props?.onClose && props.onClose(e);
|
|
39
|
+
},
|
|
40
|
+
[props?.onClose],
|
|
41
|
+
);
|
|
42
|
+
const onScrimClick = (0, react_1.useCallback)(
|
|
43
|
+
(e) => {
|
|
44
|
+
props?.onScrimClick && props.onScrimClick(e);
|
|
45
|
+
},
|
|
46
|
+
[props?.onScrimClick],
|
|
47
|
+
);
|
|
48
|
+
const animatedTranslateX = animatedValue.interpolate({
|
|
49
|
+
inputRange: [0, 1],
|
|
50
|
+
outputRange: drawerPosition === 'left' ? [-width * 0.8, 0] : drawerPosition === 'right' ? [width * 0.8, 0] : [0, 0],
|
|
51
|
+
});
|
|
52
|
+
const animatedTranslateY = animatedValue.interpolate({
|
|
53
|
+
inputRange: [0, 1],
|
|
54
|
+
outputRange: [height, height * 0.5],
|
|
55
|
+
});
|
|
56
|
+
const animatedOpacity = animatedValue.interpolate({
|
|
57
|
+
inputRange: [0, 1],
|
|
58
|
+
outputRange: [0, 0.5],
|
|
59
|
+
});
|
|
60
|
+
const animatedStyle = {
|
|
61
|
+
transform:
|
|
62
|
+
drawerPosition === 'left' || drawerPosition === 'right' ? [{ translateX: animatedTranslateX }] : [{ translateY: animatedTranslateY }],
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
props: {
|
|
66
|
+
...rest,
|
|
67
|
+
onClose,
|
|
68
|
+
onScrimClick,
|
|
69
|
+
animationConfig: {
|
|
70
|
+
animatedOpacity,
|
|
71
|
+
animatedStyle,
|
|
72
|
+
},
|
|
73
|
+
drawerPosition: drawerPosition ?? 'left',
|
|
74
|
+
children,
|
|
75
|
+
showHandle,
|
|
76
|
+
open: internalOpen,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
74
79
|
};
|
|
75
80
|
exports.useDrawer = useDrawer;
|
|
76
|
-
//# sourceMappingURL=useDrawer.js.map
|
|
81
|
+
//# sourceMappingURL=useDrawer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDrawer.js","sourceRoot":"","sources":["../src/useDrawer.ts"],"names":[],"mappings":";;;AAAA,iCAAiE;AACjE,+CAAoD;AAMpD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,yBAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAE5C,MAAM,SAAS,GAAG,CAAC,KAAkB,EAAc,EAAE;
|
|
1
|
+
{"version":3,"file":"useDrawer.js","sourceRoot":"","sources":["../src/useDrawer.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,79 +1,88 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-react-native/drawer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "A cross-platform Drawer component using the Fluent Design System",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/microsoft/fluentui-react-native.git",
|
|
8
|
+
"directory": "packages/components/Drawer"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "",
|
|
8
12
|
"exports": {
|
|
9
13
|
".": {
|
|
14
|
+
"types": "./lib/index.d.ts",
|
|
10
15
|
"import": "./lib/index.js",
|
|
11
|
-
"require": "./lib-commonjs/index.js"
|
|
12
|
-
"types": "./lib/index.d.ts"
|
|
16
|
+
"require": "./lib-commonjs/index.js"
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
|
-
"
|
|
19
|
+
"main": "lib-commonjs/index.js",
|
|
20
|
+
"module": "lib/index.js",
|
|
21
|
+
"types": "lib/index.d.ts",
|
|
16
22
|
"scripts": {
|
|
17
23
|
"build": "fluentui-scripts build",
|
|
24
|
+
"build-cjs": "tsgo --outDir lib-commonjs",
|
|
25
|
+
"build-esm": "tsgo --outDir lib --module esnext --moduleResolution bundler",
|
|
18
26
|
"clean": "fluentui-scripts clean",
|
|
19
27
|
"depcheck": "fluentui-scripts depcheck",
|
|
20
|
-
"just": "fluentui-scripts",
|
|
21
28
|
"lint": "fluentui-scripts eslint",
|
|
22
|
-
"
|
|
23
|
-
"update-snapshots": "fluentui-scripts jest -u",
|
|
29
|
+
"lint-package": "fluentui-scripts lint-package",
|
|
24
30
|
"prettier": "fluentui-scripts prettier",
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
"repository": {
|
|
28
|
-
"type": "git",
|
|
29
|
-
"url": "https://github.com/microsoft/fluentui-react-native.git",
|
|
30
|
-
"directory": "packages/components/Drawer"
|
|
31
|
+
"test": "fluentui-scripts jest",
|
|
32
|
+
"update-snapshots": "fluentui-scripts jest -u"
|
|
31
33
|
},
|
|
32
34
|
"dependencies": {
|
|
33
|
-
"@fluentui-react-native/framework": "0.
|
|
34
|
-
"@fluentui-react-native/interactive-hooks": "0.
|
|
35
|
-
"@fluentui-react-native/theme-tokens": "0.
|
|
36
|
-
"@fluentui-react-native/use-styling": "0.
|
|
35
|
+
"@fluentui-react-native/framework": "0.15.0",
|
|
36
|
+
"@fluentui-react-native/interactive-hooks": "0.28.0",
|
|
37
|
+
"@fluentui-react-native/theme-tokens": "0.28.0",
|
|
38
|
+
"@fluentui-react-native/use-styling": "0.14.0"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"@babel/core": "^7.20.0",
|
|
40
42
|
"@fluentui-react-native/babel-config": "0.1.1",
|
|
41
43
|
"@fluentui-react-native/eslint-config-rules": "0.1.1",
|
|
44
|
+
"@fluentui-react-native/framework-base": "0.3.0",
|
|
42
45
|
"@fluentui-react-native/jest-config": "0.1.1",
|
|
43
|
-
"@fluentui-react-native/
|
|
44
|
-
"@react-native/
|
|
45
|
-
"@react-native/
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"react": "
|
|
49
|
-
"react-native": "^0.
|
|
50
|
-
"react
|
|
51
|
-
"react-
|
|
52
|
-
"react
|
|
46
|
+
"@fluentui-react-native/kit-config": "0.1.2",
|
|
47
|
+
"@fluentui-react-native/scripts": "0.1.2",
|
|
48
|
+
"@react-native-community/cli": "^20.0.0",
|
|
49
|
+
"@react-native-community/cli-platform-android": "^20.0.0",
|
|
50
|
+
"@react-native-community/cli-platform-ios": "^20.0.0",
|
|
51
|
+
"@react-native/babel-preset": "^0.81.0",
|
|
52
|
+
"@react-native/metro-config": "^0.81.0",
|
|
53
|
+
"@types/react": "~19.1.0",
|
|
54
|
+
"@types/react-test-renderer": "^19.1.0",
|
|
55
|
+
"react": "19.1.0",
|
|
56
|
+
"react-native": "^0.81.0",
|
|
57
|
+
"react-native-macos": "^0.81.0",
|
|
58
|
+
"react-native-windows": "^0.81.0",
|
|
59
|
+
"react-test-renderer": "19.1.0"
|
|
53
60
|
},
|
|
54
61
|
"peerDependencies": {
|
|
55
62
|
"@office-iss/react-native-win32": "^0.74.0",
|
|
56
|
-
"react": "18.2.0",
|
|
57
|
-
"react
|
|
58
|
-
"react-native
|
|
59
|
-
"react-native-
|
|
63
|
+
"@types/react": "~18.2.0 || ~19.0.0 || ~19.1.0",
|
|
64
|
+
"react": "18.2.0 || 19.0.0 || 19.1.0",
|
|
65
|
+
"react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
|
|
66
|
+
"react-native-macos": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
|
|
67
|
+
"react-native-windows": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0"
|
|
68
|
+
},
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"@office-iss/react-native-win32": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"@types/react": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"react-native-macos": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"react-native-windows": {
|
|
80
|
+
"optional": true
|
|
81
|
+
}
|
|
60
82
|
},
|
|
61
|
-
"author": "",
|
|
62
|
-
"license": "MIT",
|
|
63
83
|
"rnx-kit": {
|
|
64
84
|
"kitType": "library",
|
|
65
85
|
"alignDeps": {
|
|
66
|
-
"presets": [
|
|
67
|
-
"microsoft/react-native"
|
|
68
|
-
],
|
|
69
|
-
"requirements": {
|
|
70
|
-
"development": [
|
|
71
|
-
"react-native@0.74"
|
|
72
|
-
],
|
|
73
|
-
"production": [
|
|
74
|
-
"react-native@0.73 || 0.74"
|
|
75
|
-
]
|
|
76
|
-
},
|
|
77
86
|
"capabilities": [
|
|
78
87
|
"babel-preset-react-native",
|
|
79
88
|
"core",
|
|
@@ -82,19 +91,11 @@
|
|
|
82
91
|
"core-macos",
|
|
83
92
|
"core-windows",
|
|
84
93
|
"react",
|
|
85
|
-
"react-test-renderer"
|
|
94
|
+
"react-test-renderer",
|
|
95
|
+
"tools-core",
|
|
96
|
+
"tools-jest"
|
|
86
97
|
]
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
"peerDependenciesMeta": {
|
|
90
|
-
"@office-iss/react-native-win32": {
|
|
91
|
-
"optional": true
|
|
92
98
|
},
|
|
93
|
-
"react-native-
|
|
94
|
-
"optional": true
|
|
95
|
-
},
|
|
96
|
-
"react-native-windows": {
|
|
97
|
-
"optional": true
|
|
98
|
-
}
|
|
99
|
+
"extends": "@fluentui-react-native/kit-config"
|
|
99
100
|
}
|
|
100
|
-
}
|
|
101
|
+
}
|
package/src/Drawer.tsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/** @
|
|
2
|
-
/** @jsx withSlots */
|
|
1
|
+
/** @jsxImportSource @fluentui-react-native/framework-base */
|
|
3
2
|
import { Animated, Modal, TouchableWithoutFeedback, View } from 'react-native';
|
|
4
3
|
|
|
5
4
|
import type { UseSlots } from '@fluentui-react-native/framework';
|
|
6
|
-
import { compose, mergeProps
|
|
5
|
+
import { compose, mergeProps } from '@fluentui-react-native/framework';
|
|
7
6
|
|
|
8
7
|
import { stylingSettings } from './Drawer.styling';
|
|
9
8
|
import type { DrawerType, DrawerProps } from './Drawer.types';
|
package/src/Drawer.types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
AnimatableNumericValue,
|
|
2
3
|
Animated,
|
|
3
4
|
ColorValue,
|
|
4
5
|
DimensionValue,
|
|
@@ -46,7 +47,7 @@ export interface DrawerTokens {
|
|
|
46
47
|
/**
|
|
47
48
|
* The corner radius of the handle.
|
|
48
49
|
* */
|
|
49
|
-
handleCornerRadius?:
|
|
50
|
+
handleCornerRadius?: AnimatableNumericValue | string;
|
|
50
51
|
|
|
51
52
|
/**
|
|
52
53
|
* The top margin of the handle.
|
|
@@ -86,7 +87,7 @@ export interface DrawerTokens {
|
|
|
86
87
|
* The corner radius of the Drawer
|
|
87
88
|
* @default 0
|
|
88
89
|
* */
|
|
89
|
-
drawerCornerRadius?:
|
|
90
|
+
drawerCornerRadius?: AnimatableNumericValue | string;
|
|
90
91
|
|
|
91
92
|
/**
|
|
92
93
|
* The elevation of the Drawer
|
|
@@ -132,7 +133,7 @@ export interface DrawerTokens {
|
|
|
132
133
|
* @platform iOS
|
|
133
134
|
* */
|
|
134
135
|
|
|
135
|
-
shadowRadius?:
|
|
136
|
+
shadowRadius?: AnimatableNumericValue | string;
|
|
136
137
|
|
|
137
138
|
/**
|
|
138
139
|
* Positions/Behaviours of the Drawer, This is used to apply different tokens for different positions.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { act } from 'react';
|
|
2
2
|
import { Text } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import * as renderer from 'react-test-renderer';
|
|
@@ -11,13 +11,14 @@ jest.useFakeTimers();
|
|
|
11
11
|
// Disable Drawer test, as it's still failing despite the line above
|
|
12
12
|
describe('Drawer component tests', () => {
|
|
13
13
|
it('Drawer default', () => {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
let component: renderer.ReactTestRenderer;
|
|
15
|
+
act(() => {
|
|
16
|
+
component = renderer.create(
|
|
16
17
|
// <Drawer open={false} drawerPosition="left">
|
|
17
18
|
<Text>Hello</Text>,
|
|
18
19
|
// </Drawer>,
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
expect(
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
expect(component!.toJSON()).toMatchSnapshot();
|
|
22
23
|
});
|
|
23
24
|
});
|