@cleartrip/ct-design-container 4.0.0-SNAPSHOT-rnfinaltest6.0 → 4.0.0-SNAPSHOT-rnfinaltest7.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/Container.native.d.ts +1 -2
- package/dist/Container.native.d.ts.map +1 -1
- package/dist/type.d.ts +2 -1
- package/dist/type.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/Container.native.tsx +10 -8
- package/src/type.ts +2 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { ContainerRef, IContainer } from './type';
|
|
3
|
-
declare const Container:
|
|
2
|
+
declare const Container: import("react").ForwardRefExoticComponent<IContainer & import("react").RefAttributes<ContainerRef>>;
|
|
4
3
|
export default Container;
|
|
5
4
|
//# sourceMappingURL=Container.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Container.native.d.ts","sourceRoot":"","sources":["../packages/components/Container/src/Container.native.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Container.native.d.ts","sourceRoot":"","sources":["../packages/components/Container/src/Container.native.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAQ,MAAM,QAAQ,CAAC;AAcxD,QAAA,MAAM,SAAS,qGAkGd,CAAC;AAGF,eAAe,SAAS,CAAC"}
|
package/dist/type.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MouseEventHandler, MutableRefObject } from 'react';
|
|
2
2
|
import type { Styles } from '@cleartrip/ct-design-types';
|
|
3
|
+
import { INativeUIEvent } from '@cleartrip/ct-design-event-propagation';
|
|
3
4
|
export type HapticVariant = 'subtle' | 'loud';
|
|
4
5
|
export interface HapticFeedbackProps {
|
|
5
6
|
hapticEnabled?: boolean;
|
|
@@ -17,7 +18,7 @@ export interface IContainer extends HapticFeedbackProps {
|
|
|
17
18
|
children?: React.ReactNode;
|
|
18
19
|
showScrollIndicator?: boolean;
|
|
19
20
|
as?: 'main' | 'section' | 'article' | 'div' | 'p';
|
|
20
|
-
onClick?: (event:
|
|
21
|
+
onClick?: (event: INativeUIEvent) => void;
|
|
21
22
|
onLayout?: (event: {
|
|
22
23
|
layout: {
|
|
23
24
|
height: number;
|
package/dist/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../packages/components/Container/src/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../packages/components/Container/src/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9C,MAAM,WAAW,mBAAmB;IAOlC,aAAa,CAAC,EAAE,OAAO,CAAC;IASxB,aAAa,CAAC,EAAE,aAAa,CAAC;IAQ9B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,aAAa,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAW,SAAQ,mBAAmB;IACrD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,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B,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAE3D,SAAS,EAAE;QACT,GAAG,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;KAClC,CAAC;IAEF,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAChE,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACpE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleartrip/ct-design-container",
|
|
3
|
-
"version": "4.0.0-SNAPSHOT-
|
|
3
|
+
"version": "4.0.0-SNAPSHOT-rnfinaltest7.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "./dist/ct-design-container.cjs.js",
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
"src"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@cleartrip/ct-design-style-manager": "4.0.0-SNAPSHOT-
|
|
28
|
-
"@cleartrip/ct-design-common-utils": "4.0.0-SNAPSHOT-
|
|
29
|
-
"@cleartrip/ct-design-
|
|
30
|
-
"@cleartrip/ct-design-
|
|
31
|
-
"@cleartrip/ct-design-theme": "4.0.0-SNAPSHOT-
|
|
27
|
+
"@cleartrip/ct-design-style-manager": "4.0.0-SNAPSHOT-rnfinaltest7.0",
|
|
28
|
+
"@cleartrip/ct-design-common-utils": "4.0.0-SNAPSHOT-rnfinaltest7.0",
|
|
29
|
+
"@cleartrip/ct-design-event-propagation": "4.0.0-SNAPSHOT-rnfinaltest7.0",
|
|
30
|
+
"@cleartrip/ct-design-conditional-wrap": "4.0.0-SNAPSHOT-rnfinaltest7.0",
|
|
31
|
+
"@cleartrip/ct-design-theme": "4.0.0-SNAPSHOT-rnfinaltest7.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@emotion/babel-plugin": "^11.12.0",
|
|
35
|
-
"@cleartrip/ct-design-types": "4.0.0-SNAPSHOT-
|
|
35
|
+
"@cleartrip/ct-design-types": "4.0.0-SNAPSHOT-rnfinaltest7.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": ">=16.8.0",
|
package/src/Container.native.tsx
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import { Pressable, View
|
|
3
|
+
import { Pressable, View } from 'react-native';
|
|
4
4
|
import { useNativeMergeStyles } from '@cleartrip/ct-design-style-manager';
|
|
5
5
|
import { getAccessibilityProps, HapticFeedback } from '@cleartrip/ct-design-common-utils';
|
|
6
6
|
import Conditional from '@cleartrip/ct-design-conditional-wrap';
|
|
7
|
-
import EventCollectorProvider, {
|
|
7
|
+
import EventCollectorProvider, {
|
|
8
|
+
INativeUIEvent,
|
|
9
|
+
useMergeEvents,
|
|
10
|
+
useTriggerEvents,
|
|
11
|
+
} from '@cleartrip/ct-design-event-propagation';
|
|
8
12
|
|
|
9
13
|
import { ContainerRef, IContainer, Rect } from './type';
|
|
10
14
|
|
|
@@ -78,15 +82,16 @@ const Container = forwardRef<ContainerRef, IContainer>(
|
|
|
78
82
|
|
|
79
83
|
const mergedRootStyles = useNativeMergeStyles(rootStyles, [rootStyles]);
|
|
80
84
|
|
|
81
|
-
const ComponentToRender
|
|
85
|
+
const ComponentToRender = onClick ? Pressable : View;
|
|
82
86
|
|
|
83
|
-
const handleClick =
|
|
87
|
+
const handleClick = (event: INativeUIEvent) => {
|
|
84
88
|
if (hapticEnabled) {
|
|
85
89
|
HapticFeedback.vibrate({ variant: hapticVariant, repeat: hapticRepeat });
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
onClick?.(event);
|
|
89
93
|
};
|
|
94
|
+
|
|
90
95
|
const mergedEvents = useMergeEvents({ onClick: [handleClick] });
|
|
91
96
|
const { onClick: onClickEvent } = useTriggerEvents(mergedEvents);
|
|
92
97
|
|
|
@@ -99,7 +104,6 @@ const Container = forwardRef<ContainerRef, IContainer>(
|
|
|
99
104
|
ref={containerRef}
|
|
100
105
|
{...accessibilityProps}
|
|
101
106
|
style={mergedRootStyles}
|
|
102
|
-
// @ts-ignore
|
|
103
107
|
onPress={onClickEvent}
|
|
104
108
|
onLayout={(e) => {
|
|
105
109
|
onLayout?.({
|
|
@@ -111,8 +115,6 @@ const Container = forwardRef<ContainerRef, IContainer>(
|
|
|
111
115
|
},
|
|
112
116
|
});
|
|
113
117
|
}}
|
|
114
|
-
bounces={false}
|
|
115
|
-
showsVerticalScrollIndicator={showScrollIndicator}
|
|
116
118
|
{...rest}
|
|
117
119
|
>
|
|
118
120
|
{children}
|
package/src/type.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MouseEventHandler, MutableRefObject } from 'react';
|
|
2
2
|
|
|
3
3
|
import type { Styles } from '@cleartrip/ct-design-types';
|
|
4
|
+
import { INativeUIEvent } from '@cleartrip/ct-design-event-propagation';
|
|
4
5
|
|
|
5
6
|
export type HapticVariant = 'subtle' | 'loud';
|
|
6
7
|
|
|
@@ -49,7 +50,7 @@ export interface IContainer extends HapticFeedbackProps {
|
|
|
49
50
|
/**
|
|
50
51
|
* Callback when user clicks on the container
|
|
51
52
|
*/
|
|
52
|
-
onClick?: (event:
|
|
53
|
+
onClick?: (event: INativeUIEvent) => void;
|
|
53
54
|
/**
|
|
54
55
|
* Callback for layout changes. Works only for native.
|
|
55
56
|
*/
|