react-native-tinyui 2.0.0 → 3.1.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/README.md +177 -42
- package/ios/Core/Tinyui.mm +3 -0
- package/ios/Core/TinyuiComponentClasses.mm +18 -0
- package/ios/SwipeActions/TinyuiSwipeActionsView.h +12 -0
- package/ios/SwipeActions/TinyuiSwipeActionsView.mm +289 -0
- package/ios/TipKit/TinyuiTip.swift +16 -0
- package/ios/TipKit/TinyuiTipPopoverProvider.swift +66 -135
- package/ios/TipKit/TinyuiTipPopoverView.mm +0 -18
- package/ios/TipKit/TinyuiTipView.h +8 -0
- package/ios/TipKit/TinyuiTipView.mm +93 -0
- package/ios/TipKit/TinyuiTipViewProvider.swift +140 -0
- package/ios/TipKit/TinyuiTipViewShadowNode.h +48 -0
- package/ios/TipKit/TinyuiTipsRuntime.swift +2 -74
- package/lib/module/SwipeActions/SwipeActionsNativeComponent.ts +19 -0
- package/lib/module/SwipeActions/actions.js +21 -0
- package/lib/module/SwipeActions/actions.js.map +1 -0
- package/lib/module/SwipeActions/index.js +43 -0
- package/lib/module/SwipeActions/index.js.map +1 -0
- package/lib/module/SwipeActions/types.js +4 -0
- package/lib/module/SwipeActions/types.js.map +1 -0
- package/lib/module/TipKit/Popover.js +0 -22
- package/lib/module/TipKit/Popover.js.map +1 -1
- package/lib/module/TipKit/TipPopoverNativeComponent.ts +0 -6
- package/lib/module/TipKit/TipViewNativeComponent.ts +28 -0
- package/lib/module/TipKit/View.js +62 -0
- package/lib/module/TipKit/View.js.map +1 -0
- package/lib/module/TipKit/index.js +2 -0
- package/lib/module/TipKit/index.js.map +1 -1
- package/lib/module/TipKit/validation.js +4 -4
- package/lib/module/TipKit/validation.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/getNativeTinyui.js.map +1 -1
- package/lib/typescript/src/SwipeActions/SwipeActionsNativeComponent.d.ts +15 -0
- package/lib/typescript/src/SwipeActions/SwipeActionsNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/SwipeActions/actions.d.ts +9 -0
- package/lib/typescript/src/SwipeActions/actions.d.ts.map +1 -0
- package/lib/typescript/src/SwipeActions/index.d.ts +4 -0
- package/lib/typescript/src/SwipeActions/index.d.ts.map +1 -0
- package/lib/typescript/src/SwipeActions/types.d.ts +37 -0
- package/lib/typescript/src/SwipeActions/types.d.ts.map +1 -0
- package/lib/typescript/src/TipKit/Popover.d.ts.map +1 -1
- package/lib/typescript/src/TipKit/TipPopoverNativeComponent.d.ts +0 -9
- package/lib/typescript/src/TipKit/TipPopoverNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/TipKit/TipViewNativeComponent.d.ts +29 -0
- package/lib/typescript/src/TipKit/TipViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/TipKit/View.d.ts +3 -0
- package/lib/typescript/src/TipKit/View.d.ts.map +1 -0
- package/lib/typescript/src/TipKit/index.d.ts +2 -1
- package/lib/typescript/src/TipKit/index.d.ts.map +1 -1
- package/lib/typescript/src/TipKit/types.d.ts +17 -15
- package/lib/typescript/src/TipKit/types.d.ts.map +1 -1
- package/lib/typescript/src/TipKit/validation.d.ts +2 -2
- package/lib/typescript/src/TipKit/validation.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/getNativeTinyui.d.ts +1 -1
- package/lib/typescript/src/utils/getNativeTinyui.d.ts.map +1 -1
- package/package.json +13 -2
- package/react-native-tinyui.podspec +6 -1
- package/src/SwipeActions/SwipeActionsNativeComponent.ts +19 -0
- package/src/SwipeActions/actions.ts +26 -0
- package/src/SwipeActions/index.tsx +54 -0
- package/src/SwipeActions/types.ts +37 -0
- package/src/TipKit/Popover.tsx +1 -21
- package/src/TipKit/TipPopoverNativeComponent.ts +0 -6
- package/src/TipKit/TipViewNativeComponent.ts +28 -0
- package/src/TipKit/View.tsx +64 -0
- package/src/TipKit/index.ts +3 -1
- package/src/TipKit/types.ts +19 -20
- package/src/TipKit/validation.ts +8 -5
- package/src/index.tsx +8 -1
- package/src/utils/getNativeTinyui.ts +1 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { TipInvalidationReason, TipKitConfiguration } from './types.js';
|
|
2
2
|
export declare const TipKit: {
|
|
3
3
|
Popover: import("react").ForwardRefExoticComponent<import("./types.js").TipPopoverProps & import("react").RefAttributes<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>>;
|
|
4
|
+
View: import("react").ForwardRefExoticComponent<import("./types.js").TipViewProps & import("react").RefAttributes<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>>;
|
|
4
5
|
/**
|
|
5
6
|
* Clear all persisted tip, event and parameter records for testing.
|
|
6
7
|
* Call and await this before configure(); rejects if already configured,
|
|
@@ -12,5 +13,5 @@ export declare const TipKit: {
|
|
|
12
13
|
/** Persistently invalidate a tip, including when its view is not mounted. */
|
|
13
14
|
invalidate(tipId: string, reason?: TipInvalidationReason): Promise<void>;
|
|
14
15
|
};
|
|
15
|
-
export type { TipAction, TipDisplayFrequency, TipError, TipInvalidationReason, TipKitConfiguration, TipPopoverProps,
|
|
16
|
+
export type { TipAction, TipDisplayFrequency, TipError, TipInvalidationReason, TipKitConfiguration, TipPopoverProps, TipViewProps, } from './types.js';
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/TipKit/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/TipKit/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAS,CAAC;AAK1E,eAAO,MAAM,MAAM;;;IAGjB;;;;OAIG;sBACqB,OAAO,CAAC,IAAI,CAAC;IAKrC,sFAAsF;sCAGnF,mBAAmB,GAAQ,OAAO,CAAC,IAAI,CAAC;IAc3C,6EAA6E;sBAEpE,MAAM,WACL,qBAAqB,GAC5B,OAAO,CAAC,IAAI,CAAC;CAQjB,CAAC;AAEF,YAAY,EACV,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,YAAY,GACb,MAAM,YAAS,CAAC"}
|
|
@@ -6,41 +6,43 @@ export interface TipKitConfiguration {
|
|
|
6
6
|
displayFrequency?: TipDisplayFrequency;
|
|
7
7
|
}
|
|
8
8
|
export type TipInvalidationReason = 'actionPerformed' | 'tipClosed';
|
|
9
|
-
export type TipStatus = {
|
|
10
|
-
status: 'pending' | 'available';
|
|
11
|
-
} | {
|
|
12
|
-
status: 'invalidated';
|
|
13
|
-
reason: TipInvalidationReason | 'displayCountExceeded' | 'displayDurationExceeded' | 'unknown';
|
|
14
|
-
};
|
|
15
9
|
export interface TipAction {
|
|
10
|
+
/** Unique nonempty identity within this tip, returned by `onActionPress`. */
|
|
16
11
|
id: string;
|
|
12
|
+
/** Nonempty button label, already localized by the app. */
|
|
17
13
|
title: string;
|
|
18
14
|
}
|
|
19
15
|
export interface TipError {
|
|
20
16
|
code: string;
|
|
21
17
|
message: string;
|
|
22
18
|
}
|
|
23
|
-
export interface
|
|
24
|
-
/** Anchor content. Its existing touch handlers are preserved. */
|
|
25
|
-
children: ReactNode;
|
|
19
|
+
export interface TipContentProps extends Omit<ViewProps, 'children'> {
|
|
26
20
|
/** Stable identity used by TipKit to persist this tip's history. */
|
|
27
21
|
tipId: string;
|
|
28
22
|
title: string;
|
|
29
23
|
message?: string;
|
|
30
24
|
systemImage?: string;
|
|
25
|
+
/** Native action buttons, each with its own id and title; TipKit controls their layout. */
|
|
31
26
|
actions?: readonly TipAction[];
|
|
32
27
|
/** Allows presentation when TipKit is also eligible. Defaults to true. */
|
|
33
28
|
enabled?: boolean;
|
|
34
29
|
/** Omit to leave the number of presentations unlimited. */
|
|
35
30
|
maxDisplayCount?: number;
|
|
36
31
|
ignoresDisplayFrequency?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
arrowEdge?: 'top' | 'bottom' | 'leading' | 'trailing' | 'auto';
|
|
39
|
-
/** TipKit eligibility, independent of whether the bubble is on screen. */
|
|
40
|
-
onStatusChange?: (status: TipStatus) => void;
|
|
41
|
-
onVisibleChange?: (visible: boolean) => void;
|
|
42
|
-
/** Actions do not automatically invalidate the tip. */
|
|
32
|
+
/** Receives the tapped button's id and title; does not automatically invalidate the tip. */
|
|
43
33
|
onActionPress?: (action: TipAction) => void;
|
|
44
34
|
onError?: (error: TipError) => void;
|
|
45
35
|
}
|
|
36
|
+
export interface TipPopoverProps extends TipContentProps {
|
|
37
|
+
/** Anchor content. Its existing touch handlers are preserved. */
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
/** Preferred arrow edge on the bubble; UIKit may adapt to available space. */
|
|
40
|
+
arrowEdge?: 'top' | 'bottom' | 'leading' | 'trailing' | 'auto';
|
|
41
|
+
}
|
|
42
|
+
export interface TipViewProps extends TipContentProps {
|
|
43
|
+
/** Inline tips render native content and do not take anchor children. */
|
|
44
|
+
children?: never;
|
|
45
|
+
/** Optional arrow on the inline view. Defaults to no arrow. */
|
|
46
|
+
arrowEdge?: 'top' | 'bottom' | 'leading' | 'trailing' | 'none';
|
|
47
|
+
}
|
|
46
48
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/TipKit/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAC7B,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE1D,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;CACxC;AAED,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG,WAAW,CAAC;AAEpE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/TipKit/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAC7B,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE1D,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;CACxC;AAED,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG,WAAW,CAAC;AAEpE,MAAM,WAAW,SAAS;IACxB,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAC;IACX,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAClE,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,OAAO,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAC/B,0EAA0E;IAC1E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,4FAA4F;IAC5F,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IAC5C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,iEAAiE;IACjE,QAAQ,EAAE,SAAS,CAAC;IACpB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;CAChE;AAED,MAAM,WAAW,YAAa,SAAQ,eAAe;IACnD,yEAAyE;IACzE,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;CAChE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TipContentProps } from './types.js';
|
|
2
2
|
export declare function validateTipId(tipId: string): void;
|
|
3
|
-
export declare function validateTip(props:
|
|
3
|
+
export declare function validateTip(props: TipContentProps, component?: string): void;
|
|
4
4
|
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../src/TipKit/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAS,CAAC;AAE/C,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAIjD;AAED,wBAAgB,WAAW,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../src/TipKit/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAS,CAAC;AAE/C,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAIjD;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,eAAe,EACtB,SAAS,SAAmB,GAC3B,IAAI,CA8BN"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { Menu } from './Menu/index.js';
|
|
2
|
+
export { SwipeActions } from './SwipeActions/index.js';
|
|
3
|
+
export type { SwipeAction, SwipeActionPressEvent, SwipeActionsEdge, SwipeActionsProps, } from './SwipeActions/index.js';
|
|
2
4
|
export { TipKit } from './TipKit/index.js';
|
|
3
|
-
export type { TipAction, TipDisplayFrequency, TipError, TipInvalidationReason, TipPopoverProps,
|
|
5
|
+
export type { TipAction, TipDisplayFrequency, TipError, TipInvalidationReason, TipPopoverProps, TipViewProps, TipKitConfiguration, } from './TipKit/index.js';
|
|
4
6
|
export type { MenuActionOption, MenuActionPressEvent, MenuActionPressEventData, MenuDividerOption, MenuItemState, MenuOption, MenuProps, MenuRef, MenuSectionOption, MenuSubmenuOption, } from './Menu/index.js';
|
|
5
7
|
export { Stepper } from './Stepper/index.js';
|
|
6
8
|
export type { StepperProps } from './Stepper/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAU,CAAC;AAClC,YAAY,EACV,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,qBAAqB,EACrB,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAgB,CAAC;AAC9C,YAAY,EACV,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,yBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAU,CAAC;AAClC,YAAY,EACV,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,mBAAmB,GACpB,MAAM,mBAAU,CAAC;AAClB,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,SAAS,EACT,OAAO,EACP,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iBAAQ,CAAC;AAEhB,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAW,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAAkB,CAAC;AAE5D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAY,CAAC;AACtC,YAAY,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,cAAc,GACf,MAAM,qBAAY,CAAC;AAEpB,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAW,CAAC;AAClD,YAAY,EACV,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EACxB,YAAY,GACb,MAAM,oBAAW,CAAC;AAEnB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,kBAAS,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAS,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAAmB,CAAC;AACpD,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,4BAAmB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Spec } from '../NativeTinyui.js';
|
|
2
|
-
export type TinyuiComponent = 'Menu' | 'Popover' | 'LiquidGlassText' | 'Stepper' | 'ConcentricView' | 'SFSymbol' | 'TipKit';
|
|
2
|
+
export type TinyuiComponent = 'Menu' | 'SwipeActions' | 'Popover' | 'LiquidGlassText' | 'Stepper' | 'ConcentricView' | 'SFSymbol' | 'TipKit';
|
|
3
3
|
/**
|
|
4
4
|
* Returns the Tinyui TurboModule instance. The native module is always
|
|
5
5
|
* compiled (Core), so this is safe to call.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNativeTinyui.d.ts","sourceRoot":"","sources":["../../../../src/utils/getNativeTinyui.ts"],"names":[],"mappings":"AAAA,OAAqB,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAiB,CAAC;AAE1D,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,SAAS,GACT,iBAAiB,GACjB,SAAS,GACT,gBAAgB,GAChB,UAAU,GACV,QAAQ,CAAC;AAKb;;;GAGG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAStC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,CAWvE"}
|
|
1
|
+
{"version":3,"file":"getNativeTinyui.d.ts","sourceRoot":"","sources":["../../../../src/utils/getNativeTinyui.ts"],"names":[],"mappings":"AAAA,OAAqB,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAiB,CAAC;AAE1D,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,cAAc,GACd,SAAS,GACT,iBAAiB,GACjB,SAAS,GACT,gBAAgB,GAChB,UAAU,GACV,QAAQ,CAAC;AAKb;;;GAGG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAStC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,CAWvE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tinyui",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Dependency-free native iOS Menu, Popover, TipKit, Stepper, ConcentricView, SFSymbol and LiquidGlassText components for React Native",
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "Dependency-free native iOS Menu, SwipeActions, Popover, TipKit, Stepper, ConcentricView, SFSymbol and LiquidGlassText components for React Native",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
"types": "./lib/typescript/src/Popover/index.d.ts",
|
|
21
21
|
"default": "./lib/module/Popover/index.js"
|
|
22
22
|
},
|
|
23
|
+
"./swipe-actions": {
|
|
24
|
+
"react-native-tinyui-source": "./src/SwipeActions/index.tsx",
|
|
25
|
+
"types": "./lib/typescript/src/SwipeActions/index.d.ts",
|
|
26
|
+
"default": "./lib/module/SwipeActions/index.js"
|
|
27
|
+
},
|
|
23
28
|
"./stepper": {
|
|
24
29
|
"react-native-tinyui-source": "./src/Stepper/index.tsx",
|
|
25
30
|
"types": "./lib/typescript/src/Stepper/index.d.ts",
|
|
@@ -152,6 +157,9 @@
|
|
|
152
157
|
}
|
|
153
158
|
},
|
|
154
159
|
"components": {
|
|
160
|
+
"TinyuiSwipeActionsView": {
|
|
161
|
+
"className": "TinyuiSwipeActionsView"
|
|
162
|
+
},
|
|
155
163
|
"TinyuiMenuView": {
|
|
156
164
|
"className": "TinyuiMenuView"
|
|
157
165
|
},
|
|
@@ -172,6 +180,9 @@
|
|
|
172
180
|
},
|
|
173
181
|
"TinyuiTipPopoverView": {
|
|
174
182
|
"className": "TinyuiTipPopoverView"
|
|
183
|
+
},
|
|
184
|
+
"TinyuiTipView": {
|
|
185
|
+
"className": "TinyuiTipView"
|
|
175
186
|
}
|
|
176
187
|
}
|
|
177
188
|
}
|
|
@@ -4,6 +4,11 @@ require "pathname"
|
|
|
4
4
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
5
5
|
|
|
6
6
|
components = {
|
|
7
|
+
"SwipeActions" => {
|
|
8
|
+
:source_files => "ios/SwipeActions/**/*.{h,m,mm,swift,cpp}",
|
|
9
|
+
:definition => "TINYUI_FEATURE_SWIPE_ACTIONS=1",
|
|
10
|
+
:frameworks => ["UIKit"],
|
|
11
|
+
},
|
|
7
12
|
"Menu" => {
|
|
8
13
|
:source_files => "ios/Menu/**/*.{h,m,mm,swift,cpp}",
|
|
9
14
|
:definition => "TINYUI_FEATURE_MENU=1",
|
|
@@ -100,7 +105,7 @@ Pod::Spec.new do |s|
|
|
|
100
105
|
s.source = { :git => "https://github.com/luoxuhai/react-native-tinyui.git", :tag => "#{s.version}" }
|
|
101
106
|
|
|
102
107
|
s.source_files = source_files
|
|
103
|
-
s.private_header_files = ["ios/Core/**/*.h", "ios/Menu/**/*.h", "ios/Popover/**/*.h", "ios/LiquidGlassText/**/*.h", "ios/Stepper/**/*.h", "ios/ConcentricView/**/*.h", "ios/SFSymbol/**/*.h", "ios/TipKit/**/*.h"]
|
|
108
|
+
s.private_header_files = ["ios/Core/**/*.h", "ios/Menu/**/*.h", "ios/SwipeActions/**/*.h", "ios/Popover/**/*.h", "ios/LiquidGlassText/**/*.h", "ios/Stepper/**/*.h", "ios/ConcentricView/**/*.h", "ios/SFSymbol/**/*.h", "ios/TipKit/**/*.h"]
|
|
104
109
|
s.preserve_paths = "ios/LiquidGlassText/GlassText-LICENSE"
|
|
105
110
|
s.swift_version = "5.0"
|
|
106
111
|
s.frameworks = frameworks unless frameworks.empty?
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
codegenNativeComponent,
|
|
3
|
+
type CodegenTypes,
|
|
4
|
+
type ViewProps,
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
7
|
+
|
|
8
|
+
export interface NativeSwipeActionsProps extends ViewProps {
|
|
9
|
+
actionsConfig: CodegenTypes.UnsafeMixed;
|
|
10
|
+
edge?: CodegenTypes.WithDefault<'leading' | 'trailing', 'trailing'>;
|
|
11
|
+
allowsFullSwipe?: CodegenTypes.WithDefault<boolean, true>;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
onActionPress?: DirectEventHandler<Readonly<{ id: string; title: string }>>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default codegenNativeComponent<NativeSwipeActionsProps>(
|
|
17
|
+
'TinyuiSwipeActionsView',
|
|
18
|
+
{ excludedPlatforms: ['android'] }
|
|
19
|
+
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { processColor } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { SwipeAction } from './types';
|
|
4
|
+
|
|
5
|
+
export function serializeSwipeActions(actions: readonly SwipeAction[]) {
|
|
6
|
+
const ids = new Set<string>();
|
|
7
|
+
|
|
8
|
+
return actions.map((action, index) => {
|
|
9
|
+
const id = action.id ?? `item.${index}`;
|
|
10
|
+
if (ids.has(id)) {
|
|
11
|
+
throw new Error(`SwipeActions action id "${id}" must be unique.`);
|
|
12
|
+
}
|
|
13
|
+
ids.add(id);
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
id,
|
|
17
|
+
title: action.title,
|
|
18
|
+
systemImage: action.systemImage,
|
|
19
|
+
tintColor:
|
|
20
|
+
action.tintColor === undefined
|
|
21
|
+
? undefined
|
|
22
|
+
: processColor(action.tintColor),
|
|
23
|
+
destructive: action.destructive ?? false,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { forwardRef, type ComponentRef } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { assertComponentEnabled } from '../utils';
|
|
5
|
+
import { serializeSwipeActions } from './actions';
|
|
6
|
+
import NativeSwipeActionsView from './SwipeActionsNativeComponent';
|
|
7
|
+
import type { SwipeActionsProps } from './types';
|
|
8
|
+
|
|
9
|
+
export const SwipeActions = forwardRef<
|
|
10
|
+
ComponentRef<typeof View>,
|
|
11
|
+
SwipeActionsProps
|
|
12
|
+
>(function SwipeActionsRoot(
|
|
13
|
+
{
|
|
14
|
+
actions,
|
|
15
|
+
children,
|
|
16
|
+
contentContainerStyle,
|
|
17
|
+
edge = 'trailing',
|
|
18
|
+
allowsFullSwipe = true,
|
|
19
|
+
disabled = false,
|
|
20
|
+
style,
|
|
21
|
+
...viewProps
|
|
22
|
+
},
|
|
23
|
+
ref
|
|
24
|
+
) {
|
|
25
|
+
assertComponentEnabled('SwipeActions');
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<NativeSwipeActionsView
|
|
29
|
+
{...viewProps}
|
|
30
|
+
ref={ref}
|
|
31
|
+
actionsConfig={serializeSwipeActions(actions)}
|
|
32
|
+
edge={edge}
|
|
33
|
+
allowsFullSwipe={allowsFullSwipe}
|
|
34
|
+
disabled={disabled}
|
|
35
|
+
style={[styles.container, style]}
|
|
36
|
+
>
|
|
37
|
+
<View collapsable={false} style={[styles.content, contentContainerStyle]}>
|
|
38
|
+
{children}
|
|
39
|
+
</View>
|
|
40
|
+
</NativeSwipeActionsView>
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const styles = StyleSheet.create({
|
|
45
|
+
container: { overflow: 'hidden' },
|
|
46
|
+
content: { flexGrow: 1 },
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export type {
|
|
50
|
+
SwipeAction,
|
|
51
|
+
SwipeActionPressEvent,
|
|
52
|
+
SwipeActionsEdge,
|
|
53
|
+
SwipeActionsProps,
|
|
54
|
+
} from './types';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ColorValue, StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export type SwipeActionsEdge = 'leading' | 'trailing';
|
|
5
|
+
|
|
6
|
+
export interface SwipeAction {
|
|
7
|
+
/** Stable identifier. Defaults to `item.<index>` when omitted. */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** Button title and accessible action name. */
|
|
10
|
+
title: string;
|
|
11
|
+
/** SF Symbol name. */
|
|
12
|
+
systemImage?: string;
|
|
13
|
+
/** Native action background color, including semantic and dynamic colors. */
|
|
14
|
+
tintColor?: ColorValue;
|
|
15
|
+
/** Uses the system destructive appearance. Does not remove the React row. */
|
|
16
|
+
destructive?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type SwipeActionPressEvent = Readonly<{
|
|
20
|
+
nativeEvent: Readonly<{ id: string; title: string }>;
|
|
21
|
+
}>;
|
|
22
|
+
|
|
23
|
+
export interface SwipeActionsProps extends Omit<ViewProps, 'children'> {
|
|
24
|
+
/** The React Native row content. */
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
/** Styles the moving row, including its background, corners and padding. */
|
|
27
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
28
|
+
/** Actions ordered from the selected edge inward. */
|
|
29
|
+
actions: readonly SwipeAction[];
|
|
30
|
+
/** Logical edge; respects layout direction. Defaults to `trailing`. */
|
|
31
|
+
edge?: SwipeActionsEdge;
|
|
32
|
+
/** A full swipe performs the first action. Defaults to `true`. */
|
|
33
|
+
allowsFullSwipe?: boolean;
|
|
34
|
+
/** Disables swipe actions without disabling the row's children. */
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
onActionPress?: (event: SwipeActionPressEvent) => void;
|
|
37
|
+
}
|
package/src/TipKit/Popover.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { View } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
import { assertComponentEnabled } from '../utils';
|
|
5
5
|
import NativeTipPopoverView from './TipPopoverNativeComponent';
|
|
6
|
-
import type { TipPopoverProps
|
|
6
|
+
import type { TipPopoverProps } from './types';
|
|
7
7
|
import { validateTip } from './validation';
|
|
8
8
|
|
|
9
9
|
export const Popover = forwardRef<ComponentRef<typeof View>, TipPopoverProps>(
|
|
@@ -21,8 +21,6 @@ export const Popover = forwardRef<ComponentRef<typeof View>, TipPopoverProps>(
|
|
|
21
21
|
maxDisplayCount,
|
|
22
22
|
ignoresDisplayFrequency = false,
|
|
23
23
|
arrowEdge = 'auto',
|
|
24
|
-
onStatusChange,
|
|
25
|
-
onVisibleChange,
|
|
26
24
|
onActionPress,
|
|
27
25
|
onError,
|
|
28
26
|
...viewProps
|
|
@@ -42,24 +40,6 @@ export const Popover = forwardRef<ComponentRef<typeof View>, TipPopoverProps>(
|
|
|
42
40
|
maxDisplayCount={maxDisplayCount ?? 0}
|
|
43
41
|
ignoresDisplayFrequency={ignoresDisplayFrequency}
|
|
44
42
|
arrowEdge={arrowEdge}
|
|
45
|
-
onTipStatusChange={({ nativeEvent }) => {
|
|
46
|
-
if (nativeEvent.tipId !== tipId) return;
|
|
47
|
-
if (nativeEvent.status === 'invalidated') {
|
|
48
|
-
onStatusChange?.({
|
|
49
|
-
status: 'invalidated',
|
|
50
|
-
reason: nativeEvent.reason,
|
|
51
|
-
} as TipStatus);
|
|
52
|
-
} else if (
|
|
53
|
-
nativeEvent.status === 'pending' ||
|
|
54
|
-
nativeEvent.status === 'available'
|
|
55
|
-
) {
|
|
56
|
-
onStatusChange?.({ status: nativeEvent.status });
|
|
57
|
-
}
|
|
58
|
-
}}
|
|
59
|
-
onTipVisibleChange={({ nativeEvent }) => {
|
|
60
|
-
if (nativeEvent.tipId === tipId)
|
|
61
|
-
onVisibleChange?.(nativeEvent.visible);
|
|
62
|
-
}}
|
|
63
43
|
onTipAction={({ nativeEvent }) => {
|
|
64
44
|
if (nativeEvent.tipId === tipId) {
|
|
65
45
|
onActionPress?.({ id: nativeEvent.id, title: nativeEvent.title });
|
|
@@ -15,12 +15,6 @@ export interface NativeTipPopoverProps extends ViewProps {
|
|
|
15
15
|
maxDisplayCount?: CodegenTypes.Int32;
|
|
16
16
|
ignoresDisplayFrequency?: boolean;
|
|
17
17
|
arrowEdge?: string;
|
|
18
|
-
onTipStatusChange?: DirectEventHandler<
|
|
19
|
-
Readonly<{ tipId: string; status: string; reason: string }>
|
|
20
|
-
>;
|
|
21
|
-
onTipVisibleChange?: DirectEventHandler<
|
|
22
|
-
Readonly<{ tipId: string; visible: boolean }>
|
|
23
|
-
>;
|
|
24
18
|
onTipAction?: DirectEventHandler<
|
|
25
19
|
Readonly<{ tipId: string; id: string; title: string }>
|
|
26
20
|
>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
codegenNativeComponent,
|
|
3
|
+
type CodegenTypes,
|
|
4
|
+
type ViewProps,
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
7
|
+
|
|
8
|
+
export interface NativeTipViewProps extends ViewProps {
|
|
9
|
+
tipId: string;
|
|
10
|
+
title: string;
|
|
11
|
+
message?: string;
|
|
12
|
+
systemImage?: string;
|
|
13
|
+
actions?: ReadonlyArray<Readonly<{ id: string; title: string }>>;
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
maxDisplayCount?: CodegenTypes.Int32;
|
|
16
|
+
ignoresDisplayFrequency?: boolean;
|
|
17
|
+
arrowEdge?: string;
|
|
18
|
+
onTipAction?: DirectEventHandler<
|
|
19
|
+
Readonly<{ tipId: string; id: string; title: string }>
|
|
20
|
+
>;
|
|
21
|
+
onTipError?: DirectEventHandler<
|
|
22
|
+
Readonly<{ tipId: string; code: string; message: string }>
|
|
23
|
+
>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default codegenNativeComponent<NativeTipViewProps>('TinyuiTipView', {
|
|
27
|
+
excludedPlatforms: ['android'],
|
|
28
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { forwardRef, type ComponentRef } from 'react';
|
|
2
|
+
import type { View as ReactNativeView } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { assertComponentEnabled } from '../utils';
|
|
5
|
+
import NativeTipView from './TipViewNativeComponent';
|
|
6
|
+
import type { TipViewProps } from './types';
|
|
7
|
+
import { validateTip } from './validation';
|
|
8
|
+
|
|
9
|
+
export const View = forwardRef<
|
|
10
|
+
ComponentRef<typeof ReactNativeView>,
|
|
11
|
+
TipViewProps
|
|
12
|
+
>(function TipViewRoot(props, ref) {
|
|
13
|
+
assertComponentEnabled('TipKit');
|
|
14
|
+
validateTip(props, 'TipKit.View');
|
|
15
|
+
const {
|
|
16
|
+
tipId,
|
|
17
|
+
title,
|
|
18
|
+
message,
|
|
19
|
+
systemImage,
|
|
20
|
+
actions,
|
|
21
|
+
enabled = true,
|
|
22
|
+
maxDisplayCount,
|
|
23
|
+
ignoresDisplayFrequency = false,
|
|
24
|
+
arrowEdge = 'none',
|
|
25
|
+
onActionPress,
|
|
26
|
+
onError,
|
|
27
|
+
...viewProps
|
|
28
|
+
} = props;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<NativeTipView
|
|
32
|
+
{...viewProps}
|
|
33
|
+
children={undefined}
|
|
34
|
+
ref={ref}
|
|
35
|
+
collapsable={false}
|
|
36
|
+
tipId={tipId}
|
|
37
|
+
title={title}
|
|
38
|
+
message={message}
|
|
39
|
+
systemImage={systemImage}
|
|
40
|
+
actions={actions}
|
|
41
|
+
enabled={enabled}
|
|
42
|
+
maxDisplayCount={maxDisplayCount ?? 0}
|
|
43
|
+
ignoresDisplayFrequency={ignoresDisplayFrequency}
|
|
44
|
+
arrowEdge={arrowEdge}
|
|
45
|
+
onTipAction={({ nativeEvent }) => {
|
|
46
|
+
if (nativeEvent.tipId === tipId) {
|
|
47
|
+
onActionPress?.({ id: nativeEvent.id, title: nativeEvent.title });
|
|
48
|
+
}
|
|
49
|
+
}}
|
|
50
|
+
onTipError={({ nativeEvent }) => {
|
|
51
|
+
if (nativeEvent.tipId !== tipId) return;
|
|
52
|
+
const error = {
|
|
53
|
+
code: nativeEvent.code,
|
|
54
|
+
message: nativeEvent.message,
|
|
55
|
+
};
|
|
56
|
+
if (onError) onError(error);
|
|
57
|
+
else
|
|
58
|
+
console.warn(`[TinyUI] TipKit.View ${error.code}: ${error.message}`);
|
|
59
|
+
}}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
View.displayName = 'TipKit.View';
|
package/src/TipKit/index.ts
CHANGED
|
@@ -2,9 +2,11 @@ import { assertComponentEnabled, getNativeTinyui } from '../utils';
|
|
|
2
2
|
import type { TipInvalidationReason, TipKitConfiguration } from './types';
|
|
3
3
|
import { validateTipId } from './validation';
|
|
4
4
|
import { Popover } from './Popover';
|
|
5
|
+
import { View } from './View';
|
|
5
6
|
|
|
6
7
|
export const TipKit = {
|
|
7
8
|
Popover,
|
|
9
|
+
View,
|
|
8
10
|
/**
|
|
9
11
|
* Clear all persisted tip, event and parameter records for testing.
|
|
10
12
|
* Call and await this before configure(); rejects if already configured,
|
|
@@ -53,5 +55,5 @@ export type {
|
|
|
53
55
|
TipInvalidationReason,
|
|
54
56
|
TipKitConfiguration,
|
|
55
57
|
TipPopoverProps,
|
|
56
|
-
|
|
58
|
+
TipViewProps,
|
|
57
59
|
} from './types';
|
package/src/TipKit/types.ts
CHANGED
|
@@ -11,19 +11,10 @@ export interface TipKitConfiguration {
|
|
|
11
11
|
|
|
12
12
|
export type TipInvalidationReason = 'actionPerformed' | 'tipClosed';
|
|
13
13
|
|
|
14
|
-
export type TipStatus =
|
|
15
|
-
| { status: 'pending' | 'available' }
|
|
16
|
-
| {
|
|
17
|
-
status: 'invalidated';
|
|
18
|
-
reason:
|
|
19
|
-
| TipInvalidationReason
|
|
20
|
-
| 'displayCountExceeded'
|
|
21
|
-
| 'displayDurationExceeded'
|
|
22
|
-
| 'unknown';
|
|
23
|
-
};
|
|
24
|
-
|
|
25
14
|
export interface TipAction {
|
|
15
|
+
/** Unique nonempty identity within this tip, returned by `onActionPress`. */
|
|
26
16
|
id: string;
|
|
17
|
+
/** Nonempty button label, already localized by the app. */
|
|
27
18
|
title: string;
|
|
28
19
|
}
|
|
29
20
|
|
|
@@ -32,26 +23,34 @@ export interface TipError {
|
|
|
32
23
|
message: string;
|
|
33
24
|
}
|
|
34
25
|
|
|
35
|
-
export interface
|
|
36
|
-
/** Anchor content. Its existing touch handlers are preserved. */
|
|
37
|
-
children: ReactNode;
|
|
26
|
+
export interface TipContentProps extends Omit<ViewProps, 'children'> {
|
|
38
27
|
/** Stable identity used by TipKit to persist this tip's history. */
|
|
39
28
|
tipId: string;
|
|
40
29
|
title: string;
|
|
41
30
|
message?: string;
|
|
42
31
|
systemImage?: string;
|
|
32
|
+
/** Native action buttons, each with its own id and title; TipKit controls their layout. */
|
|
43
33
|
actions?: readonly TipAction[];
|
|
44
34
|
/** Allows presentation when TipKit is also eligible. Defaults to true. */
|
|
45
35
|
enabled?: boolean;
|
|
46
36
|
/** Omit to leave the number of presentations unlimited. */
|
|
47
37
|
maxDisplayCount?: number;
|
|
48
38
|
ignoresDisplayFrequency?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
arrowEdge?: 'top' | 'bottom' | 'leading' | 'trailing' | 'auto';
|
|
51
|
-
/** TipKit eligibility, independent of whether the bubble is on screen. */
|
|
52
|
-
onStatusChange?: (status: TipStatus) => void;
|
|
53
|
-
onVisibleChange?: (visible: boolean) => void;
|
|
54
|
-
/** Actions do not automatically invalidate the tip. */
|
|
39
|
+
/** Receives the tapped button's id and title; does not automatically invalidate the tip. */
|
|
55
40
|
onActionPress?: (action: TipAction) => void;
|
|
56
41
|
onError?: (error: TipError) => void;
|
|
57
42
|
}
|
|
43
|
+
|
|
44
|
+
export interface TipPopoverProps extends TipContentProps {
|
|
45
|
+
/** Anchor content. Its existing touch handlers are preserved. */
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
/** Preferred arrow edge on the bubble; UIKit may adapt to available space. */
|
|
48
|
+
arrowEdge?: 'top' | 'bottom' | 'leading' | 'trailing' | 'auto';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface TipViewProps extends TipContentProps {
|
|
52
|
+
/** Inline tips render native content and do not take anchor children. */
|
|
53
|
+
children?: never;
|
|
54
|
+
/** Optional arrow on the inline view. Defaults to no arrow. */
|
|
55
|
+
arrowEdge?: 'top' | 'bottom' | 'leading' | 'trailing' | 'none';
|
|
56
|
+
}
|
package/src/TipKit/validation.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TipContentProps } from './types';
|
|
2
2
|
|
|
3
3
|
export function validateTipId(tipId: string): void {
|
|
4
4
|
if (typeof tipId !== 'string' || tipId.trim().length === 0) {
|
|
@@ -6,10 +6,13 @@ export function validateTipId(tipId: string): void {
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export function validateTip(
|
|
9
|
+
export function validateTip(
|
|
10
|
+
props: TipContentProps,
|
|
11
|
+
component = 'TipKit.Popover'
|
|
12
|
+
): void {
|
|
10
13
|
validateTipId(props.tipId);
|
|
11
14
|
if (typeof props.title !== 'string' || props.title.trim().length === 0) {
|
|
12
|
-
throw new Error(
|
|
15
|
+
throw new Error(`[TinyUI] ${component} title must be a nonempty string.`);
|
|
13
16
|
}
|
|
14
17
|
if (
|
|
15
18
|
props.maxDisplayCount !== undefined &&
|
|
@@ -18,7 +21,7 @@ export function validateTip(props: TipPopoverProps): void {
|
|
|
18
21
|
props.maxDisplayCount > 2147483647)
|
|
19
22
|
) {
|
|
20
23
|
throw new Error(
|
|
21
|
-
|
|
24
|
+
`[TinyUI] ${component} maxDisplayCount must be a positive 32-bit integer.`
|
|
22
25
|
);
|
|
23
26
|
}
|
|
24
27
|
const ids = new Set<string>();
|
|
@@ -31,7 +34,7 @@ export function validateTip(props: TipPopoverProps): void {
|
|
|
31
34
|
ids.has(action.id)
|
|
32
35
|
) {
|
|
33
36
|
throw new Error(
|
|
34
|
-
|
|
37
|
+
`[TinyUI] ${component} actions need unique nonempty ids and nonempty titles.`
|
|
35
38
|
);
|
|
36
39
|
}
|
|
37
40
|
ids.add(action.id);
|
package/src/index.tsx
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export { Menu } from './Menu';
|
|
2
|
+
export { SwipeActions } from './SwipeActions';
|
|
3
|
+
export type {
|
|
4
|
+
SwipeAction,
|
|
5
|
+
SwipeActionPressEvent,
|
|
6
|
+
SwipeActionsEdge,
|
|
7
|
+
SwipeActionsProps,
|
|
8
|
+
} from './SwipeActions';
|
|
2
9
|
export { TipKit } from './TipKit';
|
|
3
10
|
export type {
|
|
4
11
|
TipAction,
|
|
@@ -6,8 +13,8 @@ export type {
|
|
|
6
13
|
TipError,
|
|
7
14
|
TipInvalidationReason,
|
|
8
15
|
TipPopoverProps,
|
|
16
|
+
TipViewProps,
|
|
9
17
|
TipKitConfiguration,
|
|
10
|
-
TipStatus,
|
|
11
18
|
} from './TipKit';
|
|
12
19
|
export type {
|
|
13
20
|
MenuActionOption,
|