@fluentui-react-native/drawer 0.4.18 → 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.
Files changed (50) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/lib/Drawer.d.ts +7 -2
  3. package/lib/Drawer.d.ts.map +1 -1
  4. package/lib/Drawer.js +39 -27
  5. package/lib/Drawer.js.map +1 -1
  6. package/lib/Drawer.styling.d.ts +1 -1
  7. package/lib/Drawer.styling.js +51 -42
  8. package/lib/Drawer.types.d.ts +179 -168
  9. package/lib/Drawer.types.d.ts.map +1 -1
  10. package/lib/Drawer.types.js +1 -1
  11. package/lib/Drawer.types.js.map +1 -1
  12. package/lib/DrawerTokens.d.ts +1 -1
  13. package/lib/DrawerTokens.js +32 -32
  14. package/lib/DrawerTokens.js.map +1 -1
  15. package/lib/__tests__/Drawer.test.d.ts +1 -1
  16. package/lib/__tests__/Drawer.test.js +12 -8
  17. package/lib/__tests__/Drawer.test.js.map +1 -1
  18. package/lib/index.d.ts +1 -1
  19. package/lib/index.js +1 -1
  20. package/lib/useDrawer.d.ts +1 -1
  21. package/lib/useDrawer.d.ts.map +1 -1
  22. package/lib/useDrawer.js +72 -67
  23. package/lib/useDrawer.js.map +1 -1
  24. package/lib-commonjs/Drawer.d.ts +7 -2
  25. package/lib-commonjs/Drawer.d.ts.map +1 -1
  26. package/lib-commonjs/Drawer.js +48 -33
  27. package/lib-commonjs/Drawer.js.map +1 -1
  28. package/lib-commonjs/Drawer.styling.d.ts +1 -1
  29. package/lib-commonjs/Drawer.styling.js +56 -47
  30. package/lib-commonjs/Drawer.types.d.ts +179 -168
  31. package/lib-commonjs/Drawer.types.d.ts.map +1 -1
  32. package/lib-commonjs/Drawer.types.js +3 -3
  33. package/lib-commonjs/Drawer.types.js.map +1 -1
  34. package/lib-commonjs/DrawerTokens.d.ts +1 -1
  35. package/lib-commonjs/DrawerTokens.js +35 -35
  36. package/lib-commonjs/DrawerTokens.js.map +1 -1
  37. package/lib-commonjs/__tests__/Drawer.test.d.ts +1 -1
  38. package/lib-commonjs/__tests__/Drawer.test.js +66 -35
  39. package/lib-commonjs/__tests__/Drawer.test.js.map +1 -1
  40. package/lib-commonjs/index.d.ts +1 -1
  41. package/lib-commonjs/index.js +17 -7
  42. package/lib-commonjs/index.js.map +1 -1
  43. package/lib-commonjs/useDrawer.d.ts +1 -1
  44. package/lib-commonjs/useDrawer.d.ts.map +1 -1
  45. package/lib-commonjs/useDrawer.js +76 -71
  46. package/lib-commonjs/useDrawer.js.map +1 -1
  47. package/package.json +61 -60
  48. package/src/Drawer.tsx +2 -3
  49. package/src/Drawer.types.ts +4 -3
  50. package/src/__tests__/Drawer.test.tsx +7 -6
@@ -1,3 +1,3 @@
1
1
  import type { DrawerProps, DrawerInfo } from './Drawer.types';
2
2
  export declare const useDrawer: (props: DrawerProps) => DrawerInfo;
3
- //# sourceMappingURL=useDrawer.d.ts.map
3
+ //# sourceMappingURL=useDrawer.d.ts.map
@@ -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,UAAW,WAAW,KAAG,UAgF9C,CAAC"}
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
- "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
- }
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, open]);
38
- const onClose = (0, react_1.useCallback)((e) => {
39
- props?.onClose && props.onClose(e);
40
- }, [props?.onClose]);
41
- const onScrimClick = (0, react_1.useCallback)((e) => {
42
- props?.onScrimClick && props.onScrimClick(e);
43
- }, [props?.onScrimClick]);
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
- };
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;IAC1D,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;IAC5D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAErD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,IAAI,EAAE;YACR,eAAe,CAAC,IAAI,CAAC,CAAC;YACtB,uBAAQ,CAAC,MAAM,CAAC,aAAa,EAAE;gBAC7B,OAAO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AAG,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;AAhFW,QAAA,SAAS,GAAT,SAAS,CAgFpB"}
package/package.json CHANGED
@@ -1,79 +1,88 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/drawer",
3
- "version": "0.4.18",
3
+ "version": "0.5.0",
4
4
  "description": "A cross-platform Drawer component using the Fluent Design System",
5
- "main": "lib-commonjs/index.js",
6
- "module": "lib/index.js",
7
- "react-native": "src/index.ts",
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
- "typings": "lib/index.d.ts",
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
- "test": "fluentui-scripts jest",
23
- "update-snapshots": "fluentui-scripts jest -u",
29
+ "lint-package": "fluentui-scripts lint-package",
24
30
  "prettier": "fluentui-scripts prettier",
25
- "prettier-fix": "fluentui-scripts prettier --fix true"
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.14.16",
34
- "@fluentui-react-native/interactive-hooks": "0.27.18",
35
- "@fluentui-react-native/theme-tokens": "0.27.10",
36
- "@fluentui-react-native/use-styling": "0.13.12"
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/scripts": "0.1.1",
44
- "@react-native/babel-preset": "^0.74.0",
45
- "@react-native/metro-config": "^0.74.0",
46
- "@types/react": "~18.2.0",
47
- "@types/react-test-renderer": "^18.2.0",
48
- "react": "18.2.0",
49
- "react-native": "^0.74.0",
50
- "react-native-macos": "^0.74.0",
51
- "react-native-windows": "^0.74.0",
52
- "react-test-renderer": "18.2.0"
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-native": "^0.73.0 || ^0.74.0",
58
- "react-native-macos": "^0.73.0 || ^0.74.0",
59
- "react-native-windows": "^0.73.0 || ^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",
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-macos": {
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
- /** @jsxRuntime classic */
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, withSlots } from '@fluentui-react-native/framework';
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';
@@ -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?: number;
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?: number;
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?: number;
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 * as React from 'react';
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
- const tree = renderer
15
- .create(
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
- .toJSON();
21
- expect(tree).toMatchSnapshot();
20
+ );
21
+ });
22
+ expect(component!.toJSON()).toMatchSnapshot();
22
23
  });
23
24
  });