@fluentui-react-native/drawer 0.5.0 → 0.5.3

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 (39) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/lib/Drawer.d.ts +2 -7
  3. package/lib/Drawer.js +22 -37
  4. package/lib/Drawer.styling.d.ts +1 -1
  5. package/lib/Drawer.styling.js +42 -51
  6. package/lib/Drawer.types.d.ts +168 -179
  7. package/lib/Drawer.types.js +1 -1
  8. package/lib/DrawerTokens.d.ts +1 -1
  9. package/lib/DrawerTokens.js +32 -32
  10. package/lib/DrawerTokens.js.map +1 -1
  11. package/lib/__tests__/Drawer.test.d.ts +1 -1
  12. package/lib/__tests__/Drawer.test.js +12 -12
  13. package/lib/index.d.ts +1 -1
  14. package/lib/index.js +1 -1
  15. package/lib/useDrawer.d.ts +1 -1
  16. package/lib/useDrawer.d.ts.map +1 -1
  17. package/lib/useDrawer.js +67 -72
  18. package/lib/useDrawer.js.map +1 -1
  19. package/lib-commonjs/Drawer.d.ts +2 -7
  20. package/lib-commonjs/Drawer.js +29 -47
  21. package/lib-commonjs/Drawer.styling.d.ts +1 -1
  22. package/lib-commonjs/Drawer.styling.js +47 -56
  23. package/lib-commonjs/Drawer.types.d.ts +168 -179
  24. package/lib-commonjs/Drawer.types.js +3 -3
  25. package/lib-commonjs/DrawerTokens.d.ts +1 -1
  26. package/lib-commonjs/DrawerTokens.js +35 -35
  27. package/lib-commonjs/DrawerTokens.js.map +1 -1
  28. package/lib-commonjs/__tests__/Drawer.test.d.ts +1 -1
  29. package/lib-commonjs/__tests__/Drawer.test.js +46 -63
  30. package/lib-commonjs/index.d.ts +1 -1
  31. package/lib-commonjs/index.js +7 -17
  32. package/lib-commonjs/useDrawer.d.ts +1 -1
  33. package/lib-commonjs/useDrawer.d.ts.map +1 -1
  34. package/lib-commonjs/useDrawer.js +71 -76
  35. package/lib-commonjs/useDrawer.js.map +1 -1
  36. package/package.json +26 -25
  37. package/src/DrawerTokens.ts +1 -1
  38. package/src/useDrawer.ts +17 -6
  39. package/eslint.config.js +0 -3
@@ -1,81 +1,76 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useDrawer = void 0;
4
- const react_1 = require('react');
5
- const react_native_1 = require('react-native');
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
- 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
- };
8
+ const { onBlur, onClose: onCloseProp, onFocus, onScrimClick: onScrimClickProp, 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
+ }
21
+ else {
22
+ if (isFirstOpen) {
23
+ setIsFirstOpen(false);
24
+ }
25
+ else {
26
+ react_native_1.Animated.parallel([
27
+ react_native_1.Animated.timing(animatedValue, {
28
+ toValue: 0,
29
+ duration: 300,
30
+ useNativeDriver: true,
31
+ }),
32
+ ]).start(() => {
33
+ setInternalOpen(false);
34
+ });
35
+ }
36
+ }
37
+ }, [animatedValue, isFirstOpen, open]);
38
+ const onClose = (0, react_1.useCallback)((e) => {
39
+ onCloseProp && onCloseProp(e);
40
+ }, [onCloseProp]);
41
+ const onScrimClick = (0, react_1.useCallback)((e) => {
42
+ onScrimClickProp && onScrimClickProp(e);
43
+ }, [onScrimClickProp]);
44
+ const animatedTranslateX = animatedValue.interpolate({
45
+ inputRange: [0, 1],
46
+ outputRange: drawerPosition === 'left' ? [-width * 0.8, 0] : drawerPosition === 'right' ? [width * 0.8, 0] : [0, 0],
47
+ });
48
+ const animatedTranslateY = animatedValue.interpolate({
49
+ inputRange: [0, 1],
50
+ outputRange: [height, height * 0.5],
51
+ });
52
+ const animatedOpacity = animatedValue.interpolate({
53
+ inputRange: [0, 1],
54
+ outputRange: [0, 0.5],
55
+ });
56
+ const animatedStyle = {
57
+ transform: drawerPosition === 'left' || drawerPosition === 'right' ? [{ translateX: animatedTranslateX }] : [{ translateY: animatedTranslateY }],
58
+ };
59
+ return {
60
+ props: {
61
+ ...rest,
62
+ onClose,
63
+ onScrimClick,
64
+ animationConfig: {
65
+ animatedOpacity,
66
+ animatedStyle,
67
+ },
68
+ drawerPosition: drawerPosition ?? 'left',
69
+ children,
70
+ showHandle,
71
+ open: internalOpen,
72
+ },
73
+ };
79
74
  };
80
75
  exports.useDrawer = useDrawer;
81
- //# sourceMappingURL=useDrawer.js.map
76
+ //# 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,CAAC;IAC3D,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,EAAE,UAAU,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC3H,MAAM,aAAa,GAAG,IAAA,cAAM,EAAC,IAAI,uBAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;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AAG,aAAa,CAAC,WAAW,CAAC;QAChD,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAClB,WAAW,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC;KACtB,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG;QACpB,SAAS,EACP,cAAc,KAAK,MAAM,IAAI,cAAc,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC;KACxI,CAAC;IAEF,OAAO;QACL,KAAK,EAAE;YACL,GAAG,IAAI;YACP,OAAO;YACP,YAAY;YACZ,eAAe,EAAE;gBACf,eAAe;gBACf,aAAa;aACd;YACD,cAAc,EAAE,cAAc,IAAI,MAAM;YACxC,QAAQ;YACR,UAAU;YACV,IAAI,EAAE,YAAY;SACnB;KACF,CAAC;AAAA,CACH,CAAC;AA3FW,QAAA,SAAS,GAAT,SAAS,CA2FpB"}
package/package.json CHANGED
@@ -1,68 +1,69 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/drawer",
3
- "version": "0.5.0",
3
+ "version": "0.5.3",
4
4
  "description": "A cross-platform Drawer component using the Fluent Design System",
5
+ "license": "MIT",
6
+ "author": "",
5
7
  "repository": {
6
8
  "type": "git",
7
9
  "url": "https://github.com/microsoft/fluentui-react-native.git",
8
10
  "directory": "packages/components/Drawer"
9
11
  },
10
- "license": "MIT",
11
- "author": "",
12
+ "main": "lib-commonjs/index.js",
13
+ "module": "lib/index.js",
14
+ "types": "lib/index.d.ts",
12
15
  "exports": {
13
16
  ".": {
14
17
  "types": "./lib/index.d.ts",
15
18
  "import": "./lib/index.js",
16
- "require": "./lib-commonjs/index.js"
19
+ "require": "./lib-commonjs/index.js",
20
+ "default": "./src/index.ts"
17
21
  }
18
22
  },
19
- "main": "lib-commonjs/index.js",
20
- "module": "lib/index.js",
21
- "types": "lib/index.d.ts",
22
23
  "scripts": {
23
24
  "build": "fluentui-scripts build",
24
25
  "build-cjs": "tsgo --outDir lib-commonjs",
25
- "build-esm": "tsgo --outDir lib --module esnext --moduleResolution bundler",
26
+ "build-core": "tsgo --outDir lib --module esnext --moduleResolution bundler",
26
27
  "clean": "fluentui-scripts clean",
27
28
  "depcheck": "fluentui-scripts depcheck",
28
- "lint": "fluentui-scripts eslint",
29
+ "format": "fluentui-scripts format",
30
+ "lint": "fluentui-scripts lint",
29
31
  "lint-package": "fluentui-scripts lint-package",
30
- "prettier": "fluentui-scripts prettier",
31
32
  "test": "fluentui-scripts jest",
32
33
  "update-snapshots": "fluentui-scripts jest -u"
33
34
  },
34
35
  "dependencies": {
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"
36
+ "@fluentui-react-native/framework": "0.15.3",
37
+ "@fluentui-react-native/interactive-hooks": "0.28.3",
38
+ "@fluentui-react-native/theme-tokens": "0.28.3",
39
+ "@fluentui-react-native/use-styling": "0.14.3"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@babel/core": "^7.20.0",
42
43
  "@fluentui-react-native/babel-config": "0.1.1",
43
- "@fluentui-react-native/eslint-config-rules": "0.1.1",
44
- "@fluentui-react-native/framework-base": "0.3.0",
45
- "@fluentui-react-native/jest-config": "0.1.1",
44
+ "@fluentui-react-native/framework-base": "0.3.3",
45
+ "@fluentui-react-native/jest-config": "0.1.0",
46
46
  "@fluentui-react-native/kit-config": "0.1.2",
47
- "@fluentui-react-native/scripts": "0.1.2",
47
+ "@fluentui-react-native/lint-config-rules": "0.1.3",
48
+ "@fluentui-react-native/scripts": "0.1.0",
48
49
  "@react-native-community/cli": "^20.0.0",
49
50
  "@react-native-community/cli-platform-android": "^20.0.0",
50
51
  "@react-native-community/cli-platform-ios": "^20.0.0",
51
52
  "@react-native/babel-preset": "^0.81.0",
52
53
  "@react-native/metro-config": "^0.81.0",
53
- "@types/react": "~19.1.0",
54
+ "@types/react": "~19.1.4",
54
55
  "@types/react-test-renderer": "^19.1.0",
55
- "react": "19.1.0",
56
- "react-native": "^0.81.0",
56
+ "react": "19.1.4",
57
+ "react-native": "^0.81.6",
57
58
  "react-native-macos": "^0.81.0",
58
59
  "react-native-windows": "^0.81.0",
59
- "react-test-renderer": "19.1.0"
60
+ "react-test-renderer": "19.1.4"
60
61
  },
61
62
  "peerDependencies": {
62
63
  "@office-iss/react-native-win32": "^0.74.0",
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",
64
+ "@types/react": "~18.2.0 || ~19.0.0 || ~19.1.4",
65
+ "react": "18.2.0 || 19.0.0 || 19.1.4",
66
+ "react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.6",
66
67
  "react-native-macos": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
67
68
  "react-native-windows": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0"
68
69
  },
@@ -37,4 +37,4 @@ export const defaultDrawerTokens: TokenSettings<DrawerTokens, Theme> = (t: Theme
37
37
  drawerCornerRadius: globalTokens.corner.radius120,
38
38
  height: '50%',
39
39
  },
40
- } as DrawerTokens);
40
+ }) as DrawerTokens;
package/src/useDrawer.ts CHANGED
@@ -8,7 +8,18 @@ import type { DrawerProps, DrawerInfo } from './Drawer.types';
8
8
  const { height, width } = Dimensions.get('window');
9
9
 
10
10
  export const useDrawer = (props: DrawerProps): DrawerInfo => {
11
- const { onBlur, onFocus, accessibilityLabel, open, drawerPosition = 'left', showHandle = true, children, ...rest } = props;
11
+ const {
12
+ onBlur,
13
+ onClose: onCloseProp,
14
+ onFocus,
15
+ onScrimClick: onScrimClickProp,
16
+ accessibilityLabel,
17
+ open,
18
+ drawerPosition = 'left',
19
+ showHandle = true,
20
+ children,
21
+ ...rest
22
+ } = props;
12
23
  const animatedValue = useRef(new Animated.Value(0)).current;
13
24
  const [internalOpen, setInternalOpen] = useState(open);
14
25
  const [isFirstOpen, setIsFirstOpen] = useState(true);
@@ -36,20 +47,20 @@ export const useDrawer = (props: DrawerProps): DrawerInfo => {
36
47
  });
37
48
  }
38
49
  }
39
- }, [animatedValue, open]);
50
+ }, [animatedValue, isFirstOpen, open]);
40
51
 
41
52
  const onClose = useCallback(
42
53
  (e: InteractionEvent) => {
43
- props?.onClose && props.onClose(e);
54
+ onCloseProp && onCloseProp(e);
44
55
  },
45
- [props?.onClose],
56
+ [onCloseProp],
46
57
  );
47
58
 
48
59
  const onScrimClick = useCallback(
49
60
  (e: InteractionEvent) => {
50
- props?.onScrimClick && props.onScrimClick(e);
61
+ onScrimClickProp && onScrimClickProp(e);
51
62
  },
52
- [props?.onScrimClick],
63
+ [onScrimClickProp],
53
64
  );
54
65
 
55
66
  const animatedTranslateX = animatedValue.interpolate({
package/eslint.config.js DELETED
@@ -1,3 +0,0 @@
1
- const baseConfig = require('@fluentui-react-native/eslint-config-rules');
2
-
3
- module.exports = baseConfig;