@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.
- 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
package/lib/DrawerTokens.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import type { Theme } from '@fluentui-react-native/framework';
|
|
|
2
2
|
import type { TokenSettings } from '@fluentui-react-native/use-styling';
|
|
3
3
|
import type { DrawerTokens } from './Drawer.types';
|
|
4
4
|
export declare const defaultDrawerTokens: TokenSettings<DrawerTokens, Theme>;
|
|
5
|
-
//# sourceMappingURL=DrawerTokens.d.ts.map
|
|
5
|
+
//# sourceMappingURL=DrawerTokens.d.ts.map
|
package/lib/DrawerTokens.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { globalTokens } from '@fluentui-react-native/theme-tokens';
|
|
2
2
|
export const defaultDrawerTokens = (t) => ({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
3
|
+
scrimColor: '#00000080', // to be replace with token in future based on design guidance
|
|
4
|
+
drawerBackgroundColor: t.colors.neutralBackground2,
|
|
5
|
+
handleBackgroundColor: t.colors.neutralStroke1,
|
|
6
|
+
handleWidth: globalTokens.size360,
|
|
7
|
+
handleHeight: globalTokens.size40,
|
|
8
|
+
handleCornerRadius: globalTokens.size20,
|
|
9
|
+
handleAlignment: 'center',
|
|
10
|
+
handleMarginTop: globalTokens.size80,
|
|
11
|
+
handleMarginBottom: globalTokens.sizeNone,
|
|
12
|
+
handleMarginEnd: globalTokens.sizeNone,
|
|
13
|
+
handleMarginStart: globalTokens.sizeNone,
|
|
14
|
+
drawerElevation: globalTokens.size100,
|
|
15
|
+
topPosition: 0,
|
|
16
|
+
left: {
|
|
17
|
+
height: '100%',
|
|
18
|
+
width: '80%',
|
|
19
|
+
leftPosition: 0,
|
|
20
|
+
drawerCornerRadius: 0,
|
|
21
|
+
},
|
|
22
|
+
right: {
|
|
23
|
+
height: '100%',
|
|
24
|
+
width: '80%',
|
|
25
|
+
rightPosition: 0,
|
|
26
|
+
drawerCornerRadius: 0,
|
|
27
|
+
},
|
|
28
|
+
bottom: {
|
|
29
|
+
bottomPosition: 0,
|
|
30
|
+
width: '100%',
|
|
31
|
+
drawerCornerRadius: globalTokens.corner.radius120,
|
|
32
|
+
height: '50%',
|
|
33
|
+
},
|
|
34
34
|
});
|
|
35
|
-
//# sourceMappingURL=DrawerTokens.js.map
|
|
35
|
+
//# sourceMappingURL=DrawerTokens.js.map
|
package/lib/DrawerTokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerTokens.js","sourceRoot":"","sources":["../src/DrawerTokens.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAKnE,MAAM,CAAC,MAAM,mBAAmB,GAAuC,CAAC,CAAQ,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"DrawerTokens.js","sourceRoot":"","sources":["../src/DrawerTokens.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAKnE,MAAM,CAAC,MAAM,mBAAmB,GAAuC,CAAC,CAAQ,EAAE,EAAE,EACjF;IACC,UAAU,EAAE,WAAW,EAAE,8DAA8D;IACvF,qBAAqB,EAAE,CAAC,CAAC,MAAM,CAAC,kBAAkB;IAClD,qBAAqB,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc;IAC9C,WAAW,EAAE,YAAY,CAAC,OAAO;IACjC,YAAY,EAAE,YAAY,CAAC,MAAM;IACjC,kBAAkB,EAAE,YAAY,CAAC,MAAM;IACvC,eAAe,EAAE,QAAQ;IACzB,eAAe,EAAE,YAAY,CAAC,MAAM;IACpC,kBAAkB,EAAE,YAAY,CAAC,QAAQ;IACzC,eAAe,EAAE,YAAY,CAAC,QAAQ;IACtC,iBAAiB,EAAE,YAAY,CAAC,QAAQ;IACxC,eAAe,EAAE,YAAY,CAAC,OAAO;IACrC,WAAW,EAAE,CAAC;IACd,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,KAAK;QACZ,YAAY,EAAE,CAAC;QACf,kBAAkB,EAAE,CAAC;KACtB;IACD,KAAK,EAAE;QACL,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,KAAK;QACZ,aAAa,EAAE,CAAC;QAChB,kBAAkB,EAAE,CAAC;KACtB;IACD,MAAM,EAAE;QACN,cAAc,EAAE,CAAC;QACjB,KAAK,EAAE,MAAM;QACb,kBAAkB,EAAE,YAAY,CAAC,MAAM,CAAC,SAAS;QACjD,MAAM,EAAE,KAAK;KACd;CACe,CAAA,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=Drawer.test.d.ts.map
|
|
2
|
+
//# sourceMappingURL=Drawer.test.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { act } from 'react';
|
|
2
3
|
import { Text } from 'react-native';
|
|
3
4
|
import * as renderer from 'react-test-renderer';
|
|
4
5
|
// import { Drawer } from '../Drawer';
|
|
@@ -6,13 +7,16 @@ import * as renderer from 'react-test-renderer';
|
|
|
6
7
|
jest.useFakeTimers();
|
|
7
8
|
// Disable Drawer test, as it's still failing despite the line above
|
|
8
9
|
describe('Drawer component tests', () => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
it('Drawer default', () => {
|
|
11
|
+
let component;
|
|
12
|
+
act(() => {
|
|
13
|
+
component = renderer.create(
|
|
12
14
|
// <Drawer open={false} drawerPosition="left">
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
_jsx(Text, { children: 'Hello' }),
|
|
16
|
+
// </Drawer>,
|
|
17
|
+
);
|
|
16
18
|
});
|
|
19
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
20
|
+
});
|
|
17
21
|
});
|
|
18
|
-
//# sourceMappingURL=Drawer.test.js.map
|
|
22
|
+
//# sourceMappingURL=Drawer.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.test.js","sourceRoot":"","sources":["../../src/__tests__/Drawer.test.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Drawer.test.js","sourceRoot":"","sources":["../../src/__tests__/Drawer.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAEhD,sCAAsC;AAEtC,+HAA+H;AAC/H,IAAI,CAAC,aAAa,EAAE,CAAC;AAErB,oEAAoE;AACpE,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC;IACvC,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAAC;QACzB,IAAI,SAAqC,CAAC;QAC1C,GAAG,CAAC,GAAG,EAAE,CAAC;YACR,SAAS,GAAG,QAAQ,CAAC,MAAM;YACzB,8CAA8C;YAC9C,KAAC,IAAI,wBAAa;YAClB,aAAa;aACd,CAAC;QAAA,CACH,CAAC,CAAC;QACH,MAAM,CAAC,SAAU,CAAC,MAAM,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;IAAA,CAC/C,CAAC,CAAC;AAAA,CACJ,CAAC,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Drawer } from './Drawer';
|
|
2
2
|
export type { DrawerProps, DrawerSlotProps, DrawerTokens, DrawerType, DrawerPositionType } from './Drawer.types';
|
|
3
3
|
export { DrawerName } from './Drawer.types';
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
package/lib/useDrawer.d.ts
CHANGED
package/lib/useDrawer.d.ts.map
CHANGED
|
@@ -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"}
|
package/lib/useDrawer.js
CHANGED
|
@@ -2,71 +2,76 @@ import { useRef, useEffect, useState, useCallback } from 'react';
|
|
|
2
2
|
import { Animated, Dimensions } from 'react-native';
|
|
3
3
|
const { height, width } = Dimensions.get('window');
|
|
4
4
|
export const useDrawer = (props) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
5
|
+
const { onBlur, onFocus, accessibilityLabel, open, drawerPosition = 'left', showHandle = true, children, ...rest } = props;
|
|
6
|
+
const animatedValue = useRef(new Animated.Value(0)).current;
|
|
7
|
+
const [internalOpen, setInternalOpen] = useState(open);
|
|
8
|
+
const [isFirstOpen, setIsFirstOpen] = useState(true);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (open) {
|
|
11
|
+
setInternalOpen(true);
|
|
12
|
+
Animated.timing(animatedValue, {
|
|
13
|
+
toValue: 1,
|
|
14
|
+
duration: 300,
|
|
15
|
+
useNativeDriver: true,
|
|
16
|
+
}).start();
|
|
17
|
+
} else {
|
|
18
|
+
if (isFirstOpen) {
|
|
19
|
+
setIsFirstOpen(false);
|
|
20
|
+
} else {
|
|
21
|
+
Animated.parallel([
|
|
22
|
+
Animated.timing(animatedValue, {
|
|
23
|
+
toValue: 0,
|
|
24
|
+
duration: 300,
|
|
25
|
+
useNativeDriver: true,
|
|
26
|
+
}),
|
|
27
|
+
]).start(() => {
|
|
28
|
+
setInternalOpen(false);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, [animatedValue, open]);
|
|
33
|
+
const onClose = useCallback(
|
|
34
|
+
(e) => {
|
|
35
|
+
props?.onClose && props.onClose(e);
|
|
36
|
+
},
|
|
37
|
+
[props?.onClose],
|
|
38
|
+
);
|
|
39
|
+
const onScrimClick = useCallback(
|
|
40
|
+
(e) => {
|
|
41
|
+
props?.onScrimClick && props.onScrimClick(e);
|
|
42
|
+
},
|
|
43
|
+
[props?.onScrimClick],
|
|
44
|
+
);
|
|
45
|
+
const animatedTranslateX = animatedValue.interpolate({
|
|
46
|
+
inputRange: [0, 1],
|
|
47
|
+
outputRange: drawerPosition === 'left' ? [-width * 0.8, 0] : drawerPosition === 'right' ? [width * 0.8, 0] : [0, 0],
|
|
48
|
+
});
|
|
49
|
+
const animatedTranslateY = animatedValue.interpolate({
|
|
50
|
+
inputRange: [0, 1],
|
|
51
|
+
outputRange: [height, height * 0.5],
|
|
52
|
+
});
|
|
53
|
+
const animatedOpacity = animatedValue.interpolate({
|
|
54
|
+
inputRange: [0, 1],
|
|
55
|
+
outputRange: [0, 0.5],
|
|
56
|
+
});
|
|
57
|
+
const animatedStyle = {
|
|
58
|
+
transform:
|
|
59
|
+
drawerPosition === 'left' || drawerPosition === 'right' ? [{ translateX: animatedTranslateX }] : [{ translateY: animatedTranslateY }],
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
props: {
|
|
63
|
+
...rest,
|
|
64
|
+
onClose,
|
|
65
|
+
onScrimClick,
|
|
66
|
+
animationConfig: {
|
|
67
|
+
animatedOpacity,
|
|
68
|
+
animatedStyle,
|
|
69
|
+
},
|
|
70
|
+
drawerPosition: drawerPosition ?? 'left',
|
|
71
|
+
children,
|
|
72
|
+
showHandle,
|
|
73
|
+
open: internalOpen,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
71
76
|
};
|
|
72
|
-
//# sourceMappingURL=useDrawer.js.map
|
|
77
|
+
//# sourceMappingURL=useDrawer.js.map
|
package/lib/useDrawer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDrawer.js","sourceRoot":"","sources":["../src/useDrawer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAMpD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAkB,EAAc,EAAE;
|
|
1
|
+
{"version":3,"file":"useDrawer.js","sourceRoot":"","sources":["../src/useDrawer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAMpD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAEnD,MAAM,CAAC,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,MAAM,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;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ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { DrawerProps } from './Drawer.types';
|
|
2
2
|
export declare const drawerLookup: (layer: string, userProps: DrawerProps) => boolean;
|
|
3
|
-
export declare const Drawer: import(
|
|
4
|
-
|
|
3
|
+
export declare const Drawer: import('@fluentui-react-native/framework').ComposableComponent<
|
|
4
|
+
DrawerProps,
|
|
5
|
+
import('./Drawer.types').DrawerSlotProps,
|
|
6
|
+
import('./Drawer.types').DrawerTokens,
|
|
7
|
+
import('@fluentui-react-native/framework').ObjectBase
|
|
8
|
+
>;
|
|
9
|
+
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../src/Drawer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../src/Drawer.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI9D,eAAO,MAAM,YAAY,oDAExB,CAAC;AAEF,eAAO,MAAM,MAAM,qNAmCjB,CAAC"}
|
package/lib-commonjs/Drawer.js
CHANGED
|
@@ -1,39 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
3
|
exports.Drawer = exports.drawerLookup = void 0;
|
|
4
|
-
|
|
5
|
-
/** @
|
|
6
|
-
const react_native_1 = require(
|
|
7
|
-
const framework_1 = require(
|
|
8
|
-
const Drawer_styling_1 = require(
|
|
9
|
-
const Drawer_types_1 = require(
|
|
10
|
-
const useDrawer_1 = require(
|
|
4
|
+
const jsx_runtime_1 = require('@fluentui-react-native/framework-base/jsx-runtime');
|
|
5
|
+
/** @jsxImportSource @fluentui-react-native/framework-base */
|
|
6
|
+
const react_native_1 = require('react-native');
|
|
7
|
+
const framework_1 = require('@fluentui-react-native/framework');
|
|
8
|
+
const Drawer_styling_1 = require('./Drawer.styling');
|
|
9
|
+
const Drawer_types_1 = require('./Drawer.types');
|
|
10
|
+
const useDrawer_1 = require('./useDrawer');
|
|
11
11
|
const drawerLookup = (layer, userProps) => {
|
|
12
|
-
|
|
12
|
+
return userProps[layer] || layer === userProps['drawerPosition'];
|
|
13
13
|
};
|
|
14
14
|
exports.drawerLookup = drawerLookup;
|
|
15
15
|
exports.Drawer = (0, framework_1.compose)({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
16
|
+
displayName: Drawer_types_1.DrawerName,
|
|
17
|
+
...Drawer_styling_1.stylingSettings,
|
|
18
|
+
slots: {
|
|
19
|
+
modal: react_native_1.Modal,
|
|
20
|
+
scrim: react_native_1.TouchableWithoutFeedback,
|
|
21
|
+
scrimContent: react_native_1.Animated.View,
|
|
22
|
+
content: react_native_1.Animated.View,
|
|
23
|
+
handle: react_native_1.View,
|
|
24
|
+
},
|
|
25
|
+
useRender: (userProps, useSlots) => {
|
|
26
|
+
const drawerProps = (0, useDrawer_1.useDrawer)(userProps).props;
|
|
27
|
+
const Slots = useSlots(userProps, (layer) => (0, exports.drawerLookup)(layer, drawerProps));
|
|
28
|
+
return (final, children) => {
|
|
29
|
+
const { open, onClose, onScrimClick, animationConfig, drawerPosition, showHandle, ...rest } = (0, framework_1.mergeProps)(
|
|
30
|
+
drawerProps,
|
|
31
|
+
final,
|
|
32
|
+
);
|
|
33
|
+
return jsx_runtime_1.jsxs(Slots.modal, {
|
|
34
|
+
...rest,
|
|
35
|
+
visible: open,
|
|
36
|
+
onRequestClose: onClose,
|
|
37
|
+
supportedOrientations: ['portrait', 'portrait-upside-down', 'landscape', 'landscape-left', 'landscape-right'],
|
|
38
|
+
animationType: 'none',
|
|
39
|
+
transparent: true,
|
|
40
|
+
children: [
|
|
41
|
+
jsx_runtime_1.jsx(Slots.scrim, {
|
|
42
|
+
onPress: onScrimClick,
|
|
43
|
+
children: jsx_runtime_1.jsx(Slots.scrimContent, { style: [{ opacity: animationConfig.animatedOpacity }] }),
|
|
44
|
+
}),
|
|
45
|
+
jsx_runtime_1.jsxs(Slots.content, {
|
|
46
|
+
style: animationConfig.animatedStyle,
|
|
47
|
+
children: [drawerPosition === 'bottom' && showHandle && jsx_runtime_1.jsx(Slots.handle, {}), children],
|
|
48
|
+
}),
|
|
49
|
+
],
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
},
|
|
38
53
|
});
|
|
39
|
-
//# sourceMappingURL=Drawer.js.map
|
|
54
|
+
//# sourceMappingURL=Drawer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../src/Drawer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../src/Drawer.tsx"],"names":[],"mappings":";;;;AAAA,6DAA6D;AAC7D,+CAA+E;AAG/E,gEAAuE;AAEvE,qDAAmD;AAEnD,iDAA4C;AAC5C,2CAAwC;AAEjC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,SAAsB,EAAW,EAAE,CAAC;IAC9E,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,SAAS,CAAC,gBAAgB,CAAC,CAAC;AAAA,CAClE,CAAC;AAFW,QAAA,YAAY,GAAZ,YAAY,CAEvB;AAEW,QAAA,MAAM,GAAG,IAAA,mBAAO,EAAa;IACxC,WAAW,EAAE,yBAAU;IACvB,GAAG,gCAAe;IAClB,KAAK,EAAE;QACL,KAAK,EAAE,oBAAK;QACZ,KAAK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ACF,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { UseStylingOptions } from '@fluentui-react-native/framework';
|
|
2
2
|
import type { DrawerTokens, DrawerSlotProps, DrawerProps } from './Drawer.types';
|
|
3
3
|
export declare const stylingSettings: UseStylingOptions<DrawerProps, DrawerSlotProps, DrawerTokens>;
|
|
4
|
-
//# sourceMappingURL=Drawer.styling.d.ts.map
|
|
4
|
+
//# sourceMappingURL=Drawer.styling.d.ts.map
|
|
@@ -1,50 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
3
|
exports.stylingSettings = void 0;
|
|
4
|
-
const framework_1 = require(
|
|
5
|
-
const Drawer_types_1 = require(
|
|
6
|
-
const DrawerTokens_1 = require(
|
|
4
|
+
const framework_1 = require('@fluentui-react-native/framework');
|
|
5
|
+
const Drawer_types_1 = require('./Drawer.types');
|
|
6
|
+
const DrawerTokens_1 = require('./DrawerTokens');
|
|
7
7
|
exports.stylingSettings = {
|
|
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
|
-
|
|
8
|
+
tokens: [DrawerTokens_1.defaultDrawerTokens, Drawer_types_1.DrawerName],
|
|
9
|
+
tokensThatAreAlsoProps: 'all',
|
|
10
|
+
states: ['left', 'right', 'bottom'],
|
|
11
|
+
slotProps: {
|
|
12
|
+
scrimContent: (0, framework_1.buildProps)(
|
|
13
|
+
(tokens, _theme) => ({
|
|
14
|
+
style: {
|
|
15
|
+
position: 'absolute',
|
|
16
|
+
top: 0,
|
|
17
|
+
left: 0,
|
|
18
|
+
width: '100%',
|
|
19
|
+
height: '100%',
|
|
20
|
+
backgroundColor: tokens.scrimColor,
|
|
21
|
+
opacity: tokens.scrimOpacity,
|
|
22
|
+
},
|
|
23
|
+
}),
|
|
24
|
+
['scrimColor'],
|
|
25
|
+
),
|
|
26
|
+
content: (0, framework_1.buildProps)(
|
|
27
|
+
(tokens, _theme) => ({
|
|
28
|
+
style: {
|
|
29
|
+
position: 'absolute',
|
|
30
|
+
height: tokens.height,
|
|
31
|
+
width: tokens.width,
|
|
32
|
+
elevation: tokens.drawerElevation,
|
|
33
|
+
borderTopEndRadius: tokens.drawerCornerRadius,
|
|
34
|
+
borderTopStartRadius: tokens.drawerCornerRadius,
|
|
35
|
+
right: tokens.rightPosition,
|
|
36
|
+
left: tokens.leftPosition,
|
|
37
|
+
bottom: tokens.bottomPosition,
|
|
38
|
+
top: tokens.topPosition,
|
|
39
|
+
backgroundColor: tokens.drawerBackgroundColor,
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
['drawerBackgroundColor', 'drawerElevation', 'height', 'width'],
|
|
43
|
+
),
|
|
44
|
+
handle: (0, framework_1.buildProps)(
|
|
45
|
+
(tokens, _theme) => ({
|
|
46
|
+
style: {
|
|
47
|
+
width: tokens.handleWidth,
|
|
48
|
+
height: tokens.handleHeight,
|
|
49
|
+
borderRadius: tokens.handleCornerRadius,
|
|
50
|
+
backgroundColor: tokens.handleBackgroundColor,
|
|
51
|
+
alignSelf: tokens.handleAlignment,
|
|
52
|
+
marginTop: tokens.handleMarginTop,
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
['handleWidth', 'handleHeight', 'handleCornerRadius', 'handleBackgroundColor', 'handleAlignment', 'handleMarginTop'],
|
|
56
|
+
),
|
|
57
|
+
},
|
|
49
58
|
};
|
|
50
|
-
//# sourceMappingURL=Drawer.styling.js.map
|
|
59
|
+
//# sourceMappingURL=Drawer.styling.js.map
|