react-native-tinyui 0.1.1
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/LICENSE +20 -0
- package/README.md +172 -0
- package/Tinyui.podspec +85 -0
- package/ios/Core/Tinyui.h +8 -0
- package/ios/Core/Tinyui.mm +30 -0
- package/ios/Core/TinyuiComponentClasses.mm +27 -0
- package/ios/Core/TinyuiHostingHelpers.swift +74 -0
- package/ios/Menu/TinyuiMenuProvider.swift +110 -0
- package/ios/Menu/TinyuiMenuView.h +14 -0
- package/ios/Menu/TinyuiMenuView.mm +120 -0
- package/ios/Menu/TinyuiMenuViewSwift.swift +368 -0
- package/ios/Popover/TinyuiPopoverProvider.swift +111 -0
- package/ios/Popover/TinyuiPopoverView.h +14 -0
- package/ios/Popover/TinyuiPopoverView.mm +124 -0
- package/ios/Popover/TinyuiPopoverViewSwift.swift +88 -0
- package/lib/module/Menu.js +43 -0
- package/lib/module/Menu.js.map +1 -0
- package/lib/module/Menu.types.js +4 -0
- package/lib/module/Menu.types.js.map +1 -0
- package/lib/module/MenuNativeComponent.ts +14 -0
- package/lib/module/MenuOptions.js +73 -0
- package/lib/module/MenuOptions.js.map +1 -0
- package/lib/module/NativeTinyui.js +5 -0
- package/lib/module/NativeTinyui.js.map +1 -0
- package/lib/module/Popover.js +71 -0
- package/lib/module/Popover.js.map +1 -0
- package/lib/module/Popover.types.js +4 -0
- package/lib/module/Popover.types.js.map +1 -0
- package/lib/module/PopoverNativeComponent.ts +13 -0
- package/lib/module/PopoverPrimitives.js +33 -0
- package/lib/module/PopoverPrimitives.js.map +1 -0
- package/lib/module/getNativeTinyui.js +30 -0
- package/lib/module/getNativeTinyui.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/react-native.d.js +2 -0
- package/lib/module/react-native.d.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/Menu.d.ts +4 -0
- package/lib/typescript/src/Menu.d.ts.map +1 -0
- package/lib/typescript/src/Menu.types.d.ts +63 -0
- package/lib/typescript/src/Menu.types.d.ts.map +1 -0
- package/lib/typescript/src/MenuNativeComponent.d.ts +14 -0
- package/lib/typescript/src/MenuNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/MenuOptions.d.ts +7 -0
- package/lib/typescript/src/MenuOptions.d.ts.map +1 -0
- package/lib/typescript/src/NativeTinyui.d.ts +11 -0
- package/lib/typescript/src/NativeTinyui.d.ts.map +1 -0
- package/lib/typescript/src/Popover.d.ts +7 -0
- package/lib/typescript/src/Popover.d.ts.map +1 -0
- package/lib/typescript/src/Popover.types.d.ts +35 -0
- package/lib/typescript/src/Popover.types.d.ts.map +1 -0
- package/lib/typescript/src/PopoverNativeComponent.d.ts +13 -0
- package/lib/typescript/src/PopoverNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/PopoverPrimitives.d.ts +21 -0
- package/lib/typescript/src/PopoverPrimitives.d.ts.map +1 -0
- package/lib/typescript/src/getNativeTinyui.d.ts +13 -0
- package/lib/typescript/src/getNativeTinyui.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +7 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +175 -0
- package/src/Menu.tsx +52 -0
- package/src/Menu.types.ts +77 -0
- package/src/MenuNativeComponent.ts +14 -0
- package/src/MenuOptions.ts +146 -0
- package/src/NativeTinyui.ts +12 -0
- package/src/Popover.tsx +92 -0
- package/src/Popover.types.ts +49 -0
- package/src/PopoverNativeComponent.ts +13 -0
- package/src/PopoverPrimitives.tsx +36 -0
- package/src/getNativeTinyui.ts +38 -0
- package/src/index.tsx +23 -0
- package/src/react-native.d.ts +5 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { assertComponentEnabled } from "./getNativeTinyui.js";
|
|
6
|
+
import NativeMenuView from './MenuNativeComponent';
|
|
7
|
+
import { serializeMenuOptions } from "./MenuOptions.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const MenuRoot = /*#__PURE__*/forwardRef(function Menu({
|
|
10
|
+
accessibilityLabel,
|
|
11
|
+
children,
|
|
12
|
+
disabled,
|
|
13
|
+
onPrimaryAction,
|
|
14
|
+
options,
|
|
15
|
+
testID,
|
|
16
|
+
...viewProps
|
|
17
|
+
}, ref) {
|
|
18
|
+
assertComponentEnabled('Menu');
|
|
19
|
+
const {
|
|
20
|
+
config,
|
|
21
|
+
callbacks
|
|
22
|
+
} = serializeMenuOptions(options);
|
|
23
|
+
return /*#__PURE__*/_jsx(View, {
|
|
24
|
+
...viewProps,
|
|
25
|
+
ref: ref,
|
|
26
|
+
collapsable: false,
|
|
27
|
+
children: /*#__PURE__*/_jsx(NativeMenuView, {
|
|
28
|
+
accessibilityLabel: accessibilityLabel,
|
|
29
|
+
disabled: disabled,
|
|
30
|
+
hasPrimaryAction: onPrimaryAction != null,
|
|
31
|
+
menuConfig: config,
|
|
32
|
+
onItemPress: event => callbacks.get(event.nativeEvent.id)?.(),
|
|
33
|
+
onPrimaryAction: onPrimaryAction,
|
|
34
|
+
testID: testID,
|
|
35
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
36
|
+
collapsable: false,
|
|
37
|
+
children: children
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
export const Menu = MenuRoot;
|
|
43
|
+
//# sourceMappingURL=Menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","View","assertComponentEnabled","NativeMenuView","serializeMenuOptions","jsx","_jsx","MenuRoot","Menu","accessibilityLabel","children","disabled","onPrimaryAction","options","testID","viewProps","ref","config","callbacks","collapsable","hasPrimaryAction","menuConfig","onItemPress","event","get","nativeEvent","id"],"sourceRoot":"../../src","sources":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"","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { codegenNativeComponent, type ViewProps } from 'react-native';
|
|
2
|
+
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
|
|
4
|
+
export interface NativeMenuProps extends ViewProps {
|
|
5
|
+
menuConfig: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
hasPrimaryAction?: boolean;
|
|
8
|
+
onItemPress?: DirectEventHandler<Readonly<{ id: string }>>;
|
|
9
|
+
onPrimaryAction?: DirectEventHandler<null>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default codegenNativeComponent<NativeMenuProps>('TinyuiMenuView', {
|
|
13
|
+
excludedPlatforms: ['android'],
|
|
14
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { processColor } from 'react-native';
|
|
4
|
+
function serializeColor(color) {
|
|
5
|
+
return color === undefined ? undefined : processColor(color);
|
|
6
|
+
}
|
|
7
|
+
export function serializeMenuOptions(options) {
|
|
8
|
+
const callbacks = new Map();
|
|
9
|
+
const items = serializeOptions(options, callbacks, new Set(), 'root');
|
|
10
|
+
return {
|
|
11
|
+
callbacks,
|
|
12
|
+
config: JSON.stringify({
|
|
13
|
+
items
|
|
14
|
+
})
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function serializeOptions(options, callbacks, usedIds, path) {
|
|
18
|
+
return options.map((option, index) => {
|
|
19
|
+
const optionPath = `${path}.${index}`;
|
|
20
|
+
if (option.type === 'divider') {
|
|
21
|
+
return {
|
|
22
|
+
type: 'separator'
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (option.type === 'submenu') {
|
|
26
|
+
return {
|
|
27
|
+
type: 'submenu',
|
|
28
|
+
title: option.title,
|
|
29
|
+
subtitle: option.subtitle,
|
|
30
|
+
systemImage: option.systemImage,
|
|
31
|
+
icon: option.icon,
|
|
32
|
+
iconColor: serializeColor(option.iconColor),
|
|
33
|
+
titleColor: serializeColor(option.titleColor),
|
|
34
|
+
destructive: option.destructive ?? false,
|
|
35
|
+
disabled: option.disabled ?? false,
|
|
36
|
+
hidden: option.hidden ?? false,
|
|
37
|
+
displayInline: option.displayInline ?? false,
|
|
38
|
+
children: serializeOptions(option.options, callbacks, usedIds, `${optionPath}.submenu`)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (option.type === 'section') {
|
|
42
|
+
return {
|
|
43
|
+
type: 'section',
|
|
44
|
+
title: option.title,
|
|
45
|
+
children: serializeOptions(option.options, callbacks, usedIds, `${optionPath}.section`)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const id = option.id ?? `item.${optionPath}`;
|
|
49
|
+
if (usedIds.has(id)) {
|
|
50
|
+
throw new Error(`Menu option id "${id}" must be unique within a menu.`);
|
|
51
|
+
}
|
|
52
|
+
usedIds.add(id);
|
|
53
|
+
if (option.onSelect) {
|
|
54
|
+
callbacks.set(id, option.onSelect);
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
type: 'action',
|
|
58
|
+
id,
|
|
59
|
+
title: option.title,
|
|
60
|
+
subtitle: option.subtitle,
|
|
61
|
+
systemImage: option.systemImage,
|
|
62
|
+
icon: option.icon,
|
|
63
|
+
iconColor: serializeColor(option.iconColor),
|
|
64
|
+
titleColor: serializeColor(option.titleColor),
|
|
65
|
+
state: option.state ?? 'off',
|
|
66
|
+
destructive: option.destructive ?? false,
|
|
67
|
+
disabled: option.disabled ?? false,
|
|
68
|
+
hidden: option.hidden ?? false,
|
|
69
|
+
keepOpen: option.keepOpen ?? false
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=MenuOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["processColor","serializeColor","color","undefined","serializeMenuOptions","options","callbacks","Map","items","serializeOptions","Set","config","JSON","stringify","usedIds","path","map","option","index","optionPath","type","title","subtitle","systemImage","icon","iconColor","titleColor","destructive","disabled","hidden","displayInline","children","id","has","Error","add","onSelect","set","state","keepOpen"],"sourceRoot":"../../src","sources":["MenuOptions.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAyB,cAAc;AAuD5D,SAASC,cAAcA,CAACC,KAA6B,EAAmB;EACtE,OAAOA,KAAK,KAAKC,SAAS,GAAGA,SAAS,GAAGH,YAAY,CAACE,KAAK,CAAC;AAC9D;AAEA,OAAO,SAASE,oBAAoBA,CAClCC,OAA8B,EACP;EACvB,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAAqB,CAAC;EAC/C,MAAMC,KAAK,GAAGC,gBAAgB,CAACJ,OAAO,EAAEC,SAAS,EAAE,IAAII,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC;EAErE,OAAO;IACLJ,SAAS;IACTK,MAAM,EAAEC,IAAI,CAACC,SAAS,CAAC;MAAEL;IAAM,CAAC;EAClC,CAAC;AACH;AAEA,SAASC,gBAAgBA,CACvBJ,OAA8B,EAC9BC,SAAkC,EAClCQ,OAAoB,EACpBC,IAAY,EACS;EACrB,OAAOV,OAAO,CAACW,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK,KAAK;IACpC,MAAMC,UAAU,GAAG,GAAGJ,IAAI,IAAIG,KAAK,EAAE;IAErC,IAAID,MAAM,CAACG,IAAI,KAAK,SAAS,EAAE;MAC7B,OAAO;QAAEA,IAAI,EAAE;MAAY,CAAC;IAC9B;IAEA,IAAIH,MAAM,CAACG,IAAI,KAAK,SAAS,EAAE;MAC7B,OAAO;QACLA,IAAI,EAAE,SAAS;QACfC,KAAK,EAAEJ,MAAM,CAACI,KAAK;QACnBC,QAAQ,EAAEL,MAAM,CAACK,QAAQ;QACzBC,WAAW,EAAEN,MAAM,CAACM,WAAW;QAC/BC,IAAI,EAAEP,MAAM,CAACO,IAAI;QACjBC,SAAS,EAAExB,cAAc,CAACgB,MAAM,CAACQ,SAAS,CAAC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Ac,CAACgB,MAAM,CAACQ,SAAS,CAAC;MAC3CC,UAAU,EAAEzB,cAAc,CAACgB,MAAM,CAACS,UAAU,CAAC;MAC7CY,KAAK,EAAErB,MAAM,CAACqB,KAAK,IAAI,KAAK;MAC5BX,WAAW,EAAEV,MAAM,CAACU,WAAW,IAAI,KAAK;MACxCC,QAAQ,EAAEX,MAAM,CAACW,QAAQ,IAAI,KAAK;MAClCC,MAAM,EAAEZ,MAAM,CAACY,MAAM,IAAI,KAAK;MAC9BU,QAAQ,EAAEtB,MAAM,CAACsB,QAAQ,IAAI;IAC/B,CAAC;EACH,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeTinyui.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAUlD,eAAeA,mBAAmB,CAACC,GAAG,CAAO,QAAQ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useCallback, useState } from 'react';
|
|
4
|
+
import { PlatformColor, Pressable, StyleSheet, View } from 'react-native';
|
|
5
|
+
import { assertComponentEnabled } from "./getNativeTinyui.js";
|
|
6
|
+
import { PopoverClose } from "./PopoverPrimitives.js";
|
|
7
|
+
import NativePopoverView from './PopoverNativeComponent';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const PopoverRoot = /*#__PURE__*/forwardRef(function Popover({
|
|
10
|
+
children,
|
|
11
|
+
content,
|
|
12
|
+
open,
|
|
13
|
+
defaultOpen = false,
|
|
14
|
+
onOpenChange,
|
|
15
|
+
attachmentAnchor = 'center',
|
|
16
|
+
arrowEdge = 'none',
|
|
17
|
+
...viewProps
|
|
18
|
+
}, ref) {
|
|
19
|
+
assertComponentEnabled('Popover');
|
|
20
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
21
|
+
const isControlled = open !== undefined;
|
|
22
|
+
const isOpen = isControlled ? open : uncontrolledOpen;
|
|
23
|
+
const setOpen = useCallback(nextOpen => {
|
|
24
|
+
if (!isControlled) {
|
|
25
|
+
setUncontrolledOpen(nextOpen);
|
|
26
|
+
}
|
|
27
|
+
onOpenChange?.(nextOpen);
|
|
28
|
+
}, [isControlled, onOpenChange]);
|
|
29
|
+
const close = useCallback(() => setOpen(false), [setOpen]);
|
|
30
|
+
const renderedContent = renderContent(content, {
|
|
31
|
+
close
|
|
32
|
+
});
|
|
33
|
+
return /*#__PURE__*/_jsx(View, {
|
|
34
|
+
...viewProps,
|
|
35
|
+
ref: ref,
|
|
36
|
+
collapsable: false,
|
|
37
|
+
children: /*#__PURE__*/_jsxs(NativePopoverView, {
|
|
38
|
+
attachmentAnchor: attachmentAnchor,
|
|
39
|
+
arrowEdge: arrowEdge,
|
|
40
|
+
isPresented: isOpen,
|
|
41
|
+
onIsPresentedChange: event => {
|
|
42
|
+
if (!event.nativeEvent.isPresented && isOpen) {
|
|
43
|
+
setOpen(false);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
47
|
+
onPress: () => setOpen(true),
|
|
48
|
+
children: children
|
|
49
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
50
|
+
style: styles.content,
|
|
51
|
+
pointerEvents: "box-none",
|
|
52
|
+
children: renderedContent
|
|
53
|
+
})]
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
function renderContent(content, args) {
|
|
58
|
+
return typeof content === 'function' ? content(args) : content;
|
|
59
|
+
}
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
content: {
|
|
62
|
+
position: 'absolute',
|
|
63
|
+
backgroundColor: PlatformColor('systemBackground'),
|
|
64
|
+
overflow: 'hidden'
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
export const Popover = Object.assign(PopoverRoot, {
|
|
68
|
+
Close: PopoverClose
|
|
69
|
+
});
|
|
70
|
+
export { PopoverClose };
|
|
71
|
+
//# sourceMappingURL=Popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useCallback","useState","PlatformColor","Pressable","StyleSheet","View","assertComponentEnabled","PopoverClose","NativePopoverView","jsx","_jsx","jsxs","_jsxs","PopoverRoot","Popover","children","content","open","defaultOpen","onOpenChange","attachmentAnchor","arrowEdge","viewProps","ref","uncontrolledOpen","setUncontrolledOpen","isControlled","undefined","isOpen","setOpen","nextOpen","close","renderedContent","renderContent","collapsable","isPresented","onIsPresentedChange","event","nativeEvent","onPress","style","styles","pointerEvents","args","create","position","backgroundColor","overflow","Object","assign","Close"],"sourceRoot":"../../src","sources":["Popover.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,WAAW,EAAEC,QAAQ,QAA2B,OAAO;AAE5E,SAASC,aAAa,EAAEC,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAEzE,SAASC,sBAAsB,QAAQ,sBAAmB;AAC1D,SAASC,YAAY,QAAQ,wBAAqB;AAOlD,OAAOC,iBAAiB,MAAM,0BAA0B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEzD,MAAMC,WAAW,gBAAGd,UAAU,CAC5B,SAASe,OAAOA,CACd;EACEC,QAAQ;EACRC,OAAO;EACPC,IAAI;EACJC,WAAW,GAAG,KAAK;EACnBC,YAAY;EACZC,gBAAgB,GAAG,QAAQ;EAC3BC,SAAS,GAAG,MAAM;EAClB,GAAGC;AACL,CAAC,EACDC,GAAG,EACH;EACAjB,sBAAsB,CAAC,SAAS,CAAC;EAEjC,MAAM,CAACkB,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGxB,QAAQ,CAACiB,WAAW,CAAC;EACrE,MAAMQ,YAAY,GAAGT,IAAI,KAAKU,SAAS;EACvC,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OAAO,KAAK,UAAU,GAAGA,OAAO,CAAC2B,IAAI,CAAC,GAAG3B,OAAO;AAChE;AAEA,MAAMyB,MAAM,GAAGrC,UAAU,CAACwC,MAAM,CAAC;EAC/B5B,OAAO,EAAE;IACP6B,QAAQ,EAAE,UAAU;IACpBC,eAAe,EAAE5C,aAAa,CAAC,kBAAkB,CAAC;IAClD6C,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEF,OAAO,MAAMjC,OAAO,GAAGkC,MAAM,CAACC,MAAM,CAACpC,WAAW,EAAE;EAChDqC,KAAK,EAAE3C;AACT,CAAC,CAEA;AAED,SAASA,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["Popover.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { codegenNativeComponent, type ViewProps } from 'react-native';
|
|
2
|
+
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
|
|
4
|
+
export interface NativePopoverProps extends ViewProps {
|
|
5
|
+
isPresented?: boolean;
|
|
6
|
+
attachmentAnchor?: string;
|
|
7
|
+
arrowEdge?: string;
|
|
8
|
+
onIsPresentedChange?: DirectEventHandler<Readonly<{ isPresented: boolean }>>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default codegenNativeComponent<NativePopoverProps>('TinyuiPopoverView', {
|
|
12
|
+
excludedPlatforms: ['android'],
|
|
13
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Pressable } from 'react-native';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
/**
|
|
6
|
+
* A button that dismisses the popover. Render it inside the `content` prop
|
|
7
|
+
* and pass the `close` callback from the render-function arguments:
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <Popover
|
|
11
|
+
* content={({ close }) => (
|
|
12
|
+
* <Popover.Close close={close}>Done</Popover.Close>
|
|
13
|
+
* )}
|
|
14
|
+
* >
|
|
15
|
+
* <Button title="Open" />
|
|
16
|
+
* </Popover>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export function PopoverClose({
|
|
20
|
+
close,
|
|
21
|
+
onPress,
|
|
22
|
+
...props
|
|
23
|
+
}) {
|
|
24
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
25
|
+
...props,
|
|
26
|
+
onPress: event => {
|
|
27
|
+
onPress?.(event);
|
|
28
|
+
close();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
PopoverClose.displayName = 'Popover.Close';
|
|
33
|
+
//# sourceMappingURL=PopoverPrimitives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Pressable","jsx","_jsx","PopoverClose","close","onPress","props","event","displayName"],"sourceRoot":"../../src","sources":["PopoverPrimitives.tsx"],"mappings":";;AACA,SAASA,SAAS,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAIzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAC;EAC3BC,KAAK;EACLC,OAAO;EACP,GAAGC;AACc,CAAC,EAAa;EAC/B,oBACEJ,IAAA,CAACF,SAAS;IAAA,GACJM,KAAK;IACTD,OAAO,EAAGE,KAAK,IAAK;MAClBF,OAAO,GAAGE,KAAK,CAAC;MAChBH,KAAK,CAAC,CAAC;IACT;EAAE,CACH,CAAC;AAEN;AAEAD,YAAY,CAACK,WAAW,GAAG,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import NativeTinyui from "./NativeTinyui.js";
|
|
4
|
+
let nativeTinyui;
|
|
5
|
+
let enabledComponents;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns the Tinyui TurboModule instance. The native module is always
|
|
9
|
+
* compiled (Core), so this is safe to call.
|
|
10
|
+
*/
|
|
11
|
+
export function getNativeTinyui() {
|
|
12
|
+
nativeTinyui ??= NativeTinyui;
|
|
13
|
+
if (nativeTinyui == null) {
|
|
14
|
+
throw new Error('[TinyUI] The native Tinyui module is not available. ' + 'Make sure react-native-tinyui is linked and run pod install.');
|
|
15
|
+
}
|
|
16
|
+
return nativeTinyui;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Throws if the given component was not compiled into the native binary.
|
|
21
|
+
* Use this before rendering a component whose native view is optional.
|
|
22
|
+
*/
|
|
23
|
+
export function assertComponentEnabled(component) {
|
|
24
|
+
const tinyui = getNativeTinyui();
|
|
25
|
+
enabledComponents ??= new Set(tinyui.getEnabledComponents());
|
|
26
|
+
if (!enabledComponents.has(component)) {
|
|
27
|
+
throw new Error(`[TinyUI] The ${component} component is not installed. ` + `Add '${component}' to the 'react-native-tinyui.components' array ` + `in package.json and run pod install.`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=getNativeTinyui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeTinyui","nativeTinyui","enabledComponents","getNativeTinyui","Error","assertComponentEnabled","component","tinyui","Set","getEnabledComponents","has"],"sourceRoot":"../../src","sources":["getNativeTinyui.ts"],"mappings":";;AAAA,OAAOA,YAAY,MAAqB,mBAAgB;AAIxD,IAAIC,YAAqC;AACzC,IAAIC,iBAAkD;;AAEtD;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAA,EAAS;EACtCF,YAAY,KAAKD,YAAY;EAC7B,IAAIC,YAAY,IAAI,IAAI,EAAE;IACxB,MAAM,IAAIG,KAAK,CACb,sDAAsD,GACpD,8DACJ,CAAC;EACH;EACA,OAAOH,YAAY;AACrB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASI,sBAAsBA,CAACC,SAA0B,EAAQ;EACvE,MAAMC,MAAM,GAAGJ,eAAe,CAAC,CAAC;EAChCD,iBAAiB,KAAK,IAAIM,GAAG,CAACD,MAAM,CAACE,oBAAoB,CAAC,CAAC,CAAC;EAE5D,IAAI,CAACP,iBAAiB,CAACQ,GAAG,CAACJ,SAAS,CAAC,EAAE;IACrC,MAAM,IAAIF,KAAK,CACb,gBAAgBE,SAAS,+BAA+B,GACtD,QAAQA,SAAS,kDAAkD,GACnE,sCACJ,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Menu","Popover","PopoverClose","getNativeTinyui","assertComponentEnabled"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,WAAQ;AAW7B,SAASC,OAAO,EAAEC,YAAY,QAAQ,cAAW;AAUjD,SAASC,eAAe,EAAEC,sBAAsB,QAAQ,sBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["react-native.d.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MenuComponent } from './Menu.types.js';
|
|
2
|
+
export declare const Menu: MenuComponent;
|
|
3
|
+
export type { MenuActionOption, MenuDividerOption, MenuItemState, MenuOption, MenuProps, MenuSectionOption, MenuSubmenuOption, } from './Menu.types.js';
|
|
4
|
+
//# sourceMappingURL=Menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/Menu.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,iBAAc,CAAC;AAqC7D,eAAO,MAAM,IAAI,EAAe,aAAa,CAAC;AAE9C,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iBAAc,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ComponentRef, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
|
2
|
+
import type { ColorValue, View, ViewProps } from 'react-native';
|
|
3
|
+
export type MenuItemState = 'off' | 'on' | 'mixed';
|
|
4
|
+
interface MenuOptionLabel {
|
|
5
|
+
title: string;
|
|
6
|
+
subtitle?: string;
|
|
7
|
+
/** SF Symbol name. */
|
|
8
|
+
systemImage?: string;
|
|
9
|
+
/** Image name from the containing app's asset catalog. Takes precedence over `systemImage`. */
|
|
10
|
+
icon?: string;
|
|
11
|
+
/** Tint applied to `icon` or `systemImage`. */
|
|
12
|
+
iconColor?: ColorValue;
|
|
13
|
+
/** Foreground color applied to the option title. */
|
|
14
|
+
titleColor?: ColorValue;
|
|
15
|
+
}
|
|
16
|
+
export interface MenuActionOption extends MenuOptionLabel {
|
|
17
|
+
/** Actions are the default option type, so this can be omitted. */
|
|
18
|
+
type?: 'action';
|
|
19
|
+
/** Stable identifier returned by the native selection event. */
|
|
20
|
+
id?: string;
|
|
21
|
+
state?: MenuItemState;
|
|
22
|
+
destructive?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
hidden?: boolean;
|
|
25
|
+
/** Keep the menu visible after selection on iOS 16 and newer. */
|
|
26
|
+
keepOpen?: boolean;
|
|
27
|
+
onSelect?: () => void;
|
|
28
|
+
}
|
|
29
|
+
export interface MenuSubmenuOption extends MenuOptionLabel {
|
|
30
|
+
type: 'submenu';
|
|
31
|
+
/** Marks the submenu and its children as destructive. */
|
|
32
|
+
destructive?: boolean;
|
|
33
|
+
/** Prevents the submenu from being opened. */
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
/** Removes the submenu from the rendered menu. */
|
|
36
|
+
hidden?: boolean;
|
|
37
|
+
/** Displays the children inline instead of opening a nested menu. */
|
|
38
|
+
displayInline?: boolean;
|
|
39
|
+
options: readonly MenuOption[];
|
|
40
|
+
}
|
|
41
|
+
export interface MenuSectionOption {
|
|
42
|
+
type: 'section';
|
|
43
|
+
title?: string;
|
|
44
|
+
options: readonly MenuOption[];
|
|
45
|
+
}
|
|
46
|
+
export interface MenuDividerOption {
|
|
47
|
+
type: 'divider';
|
|
48
|
+
}
|
|
49
|
+
export type MenuOption = MenuActionOption | MenuSubmenuOption | MenuSectionOption | MenuDividerOption;
|
|
50
|
+
export interface MenuProps extends Omit<ViewProps, 'children'> {
|
|
51
|
+
/** The trigger element. */
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
/** Native menu actions, submenus, sections, and dividers. */
|
|
54
|
+
options: readonly MenuOption[];
|
|
55
|
+
/** Prevents the trigger from opening the menu. */
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
/** Called on a normal tap. When set, a long press opens the menu. */
|
|
58
|
+
onPrimaryAction?: () => void;
|
|
59
|
+
}
|
|
60
|
+
export interface MenuComponent extends ForwardRefExoticComponent<MenuProps & RefAttributes<ComponentRef<typeof View>>> {
|
|
61
|
+
}
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=Menu.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.types.d.ts","sourceRoot":"","sources":["../../../src/Menu.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,yBAAyB,EACzB,SAAS,EACT,aAAa,EACd,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhE,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,IAAI,GAAG,OAAO,CAAC;AAEnD,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,E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M,WAAW,SAAU,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC5D,2BAA2B;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,6DAA6D;IAC7D,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IAC/B,kDAAkD;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,aAAc,SAAQ,yBAAyB,CAC9D,SAAS,GAAG,aAAa,CAAC,YAAY,CAAC,OAAO,IAAI,CAAC,CAAC,CACrD;CAAG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ViewProps } from 'react-native';
|
|
2
|
+
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
export interface NativeMenuProps extends ViewProps {
|
|
4
|
+
menuConfig: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
hasPrimaryAction?: boolean;
|
|
7
|
+
onItemPress?: DirectEventHandler<Readonly<{
|
|
8
|
+
id: string;
|
|
9
|
+
}>>;
|
|
10
|
+
onPrimaryAction?: DirectEventHandler<null>;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeMenuProps>;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=MenuNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/MenuNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAEpF,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IAC3D,eAAe,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;CAC5C;;AAED,wBAEG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MenuOption } from './Menu.types.js';
|
|
2
|
+
export interface SerializedMenuOptions {
|
|
3
|
+
config: string;
|
|
4
|
+
callbacks: Map<string, () => void>;
|
|
5
|
+
}
|
|
6
|
+
export declare function serializeMenuOptions(options: readonly MenuOption[]): SerializedMenuOptions;
|
|
7
|
+
//# sourceMappingURL=MenuOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuOptions.d.ts","sourceRoot":"","sources":["../../../src/MenuOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAc,CAAC;AAgD/C,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC;CACpC;AAMD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,SAAS,UAAU,EAAE,GAC7B,qBAAqB,CAQvB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
/**
|
|
4
|
+
* Returns the names of the native components compiled into the app,
|
|
5
|
+
* based on the `react-native-tinyui.components` array in package.json.
|
|
6
|
+
*/
|
|
7
|
+
getEnabledComponents(): ReadonlyArray<string>;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: Spec | null | undefined;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=NativeTinyui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeTinyui.d.ts","sourceRoot":"","sources":["../../../src/NativeTinyui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC;;;OAGG;IACH,oBAAoB,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;CAC/C;;AAED,wBAAuD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PopoverClose } from './PopoverPrimitives.js';
|
|
2
|
+
import type { PopoverComponent } from './Popover.types.js';
|
|
3
|
+
export declare const Popover: PopoverComponent & {
|
|
4
|
+
Close: typeof PopoverClose;
|
|
5
|
+
};
|
|
6
|
+
export { PopoverClose };
|
|
7
|
+
//# sourceMappingURL=Popover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/Popover.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAqB,CAAC;AACnD,OAAO,KAAK,EACV,gBAAgB,EAIjB,MAAM,oBAAiB,CAAC;AA0EzB,eAAO,MAAM,OAAO,EAEd,gBAAgB,GAAG;IACvB,KAAK,EAAE,OAAO,YAAY,CAAC;CAC5B,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ComponentRef, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { PressableProps, View, ViewProps } from 'react-native';
|
|
4
|
+
export type PopoverAttachmentAnchor = 'leading' | 'trailing' | 'center' | 'top' | 'bottom';
|
|
5
|
+
export type PopoverArrowEdge = 'leading' | 'trailing' | 'top' | 'bottom' | 'none';
|
|
6
|
+
/** Arguments passed to a render-function `content`. */
|
|
7
|
+
export interface PopoverContentRenderArgs {
|
|
8
|
+
/** Dismisses the popover. */
|
|
9
|
+
close: () => void;
|
|
10
|
+
}
|
|
11
|
+
export type PopoverContent = ReactNode | ((args: PopoverContentRenderArgs) => ReactNode);
|
|
12
|
+
export interface PopoverProps extends Omit<ViewProps, 'children'> {
|
|
13
|
+
/** The trigger element. Tapping it opens the popover. */
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Content shown inside the popover. Pass a node, or a render function that
|
|
17
|
+
* receives `{ close }` to dismiss the popover from within the content.
|
|
18
|
+
*/
|
|
19
|
+
content: PopoverContent;
|
|
20
|
+
/** Controlled presentation state. */
|
|
21
|
+
open?: boolean;
|
|
22
|
+
/** Initial state when `open` is not controlled. */
|
|
23
|
+
defaultOpen?: boolean;
|
|
24
|
+
onOpenChange?: (open: boolean) => void;
|
|
25
|
+
attachmentAnchor?: PopoverAttachmentAnchor;
|
|
26
|
+
arrowEdge?: PopoverArrowEdge;
|
|
27
|
+
}
|
|
28
|
+
export interface PopoverComponent extends ForwardRefExoticComponent<PopoverProps & RefAttributes<ComponentRef<typeof View>>> {
|
|
29
|
+
}
|
|
30
|
+
/** Props for the `Popover.Close` helper button. */
|
|
31
|
+
export interface PopoverCloseProps extends PressableProps {
|
|
32
|
+
/** Dismisses the popover. Pass the `close` callback from the content render args. */
|
|
33
|
+
close: () => void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=Popover.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popover.types.d.ts","sourceRoot":"","sources":["../../../src/Popover.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,yBAAyB,EACzB,aAAa,EACd,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,MAAM,uBAAuB,GACjC,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEvD,MAAM,MAAM,gBAAgB,GAC1B,SAAS,GAAG,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErD,uDAAuD;AACvD,MAAM,WAAW,wBAAwB;IACvC,6BAA6B;IAC7B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,MAAM,MAAM,cAAc,GACxB,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE,wBAAwB,KAAK,SAAS,CAAC,CAAC;AAE9D,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/D,yDAAyD;IACzD,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,EAAE,cAAc,CAAC;IACxB,qCAAqC;IACrC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;IAC3C,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAiB,SAAQ,yBAAyB,CACjE,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,OAAO,IAAI,CAAC,CAAC,CACxD;CAAG;AAEJ,mDAAmD;AACnD,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,qFAAqF;IACrF,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ViewProps } from 'react-native';
|
|
2
|
+
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
export interface NativePopoverProps extends ViewProps {
|
|
4
|
+
isPresented?: boolean;
|
|
5
|
+
attachmentAnchor?: string;
|
|
6
|
+
arrowEdge?: string;
|
|
7
|
+
onIsPresentedChange?: DirectEventHandler<Readonly<{
|
|
8
|
+
isPresented: boolean;
|
|
9
|
+
}>>;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativePopoverProps>;
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=PopoverNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopoverNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/PopoverNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAEpF,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC;QAAE,WAAW,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC,CAAC;CAC9E;;AAED,wBAEG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { PopoverCloseProps } from './Popover.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* A button that dismisses the popover. Render it inside the `content` prop
|
|
5
|
+
* and pass the `close` callback from the render-function arguments:
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Popover
|
|
9
|
+
* content={({ close }) => (
|
|
10
|
+
* <Popover.Close close={close}>Done</Popover.Close>
|
|
11
|
+
* )}
|
|
12
|
+
* >
|
|
13
|
+
* <Button title="Open" />
|
|
14
|
+
* </Popover>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function PopoverClose({ close, onPress, ...props }: PopoverCloseProps): ReactNode;
|
|
18
|
+
export declare namespace PopoverClose {
|
|
19
|
+
var displayName: string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=PopoverPrimitives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopoverPrimitives.d.ts","sourceRoot":"","sources":["../../../src/PopoverPrimitives.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAiB,CAAC;AAEzD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,OAAO,EACP,GAAG,KAAK,EACT,EAAE,iBAAiB,GAAG,SAAS,CAU/B;yBAde,YAAY"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Spec } from './NativeTinyui.js';
|
|
2
|
+
export type TinyuiComponent = 'Menu' | 'Popover';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the Tinyui TurboModule instance. The native module is always
|
|
5
|
+
* compiled (Core), so this is safe to call.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getNativeTinyui(): Spec;
|
|
8
|
+
/**
|
|
9
|
+
* Throws if the given component was not compiled into the native binary.
|
|
10
|
+
* Use this before rendering a component whose native view is optional.
|
|
11
|
+
*/
|
|
12
|
+
export declare function assertComponentEnabled(component: TinyuiComponent): void;
|
|
13
|
+
//# sourceMappingURL=getNativeTinyui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNativeTinyui.d.ts","sourceRoot":"","sources":["../../../src/getNativeTinyui.ts"],"names":[],"mappings":"AAAA,OAAqB,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAgB,CAAC;AAEzD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,CAAC;AAKjD;;;GAGG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAStC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,CAWvE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Menu } from './Menu.js';
|
|
2
|
+
export type { MenuActionOption, MenuDividerOption, MenuItemState, MenuOption, MenuProps, MenuSectionOption, MenuSubmenuOption, } from './Menu.types.js';
|
|
3
|
+
export { Popover, PopoverClose } from './Popover.js';
|
|
4
|
+
export type { PopoverArrowEdge, PopoverAttachmentAnchor, PopoverCloseProps, PopoverContent, PopoverContentRenderArgs, PopoverProps, } from './Popover.types.js';
|
|
5
|
+
export { getNativeTinyui, assertComponentEnabled } from './getNativeTinyui.js';
|
|
6
|
+
export type { TinyuiComponent } from './getNativeTinyui.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAQ,CAAC;AAC9B,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iBAAc,CAAC;AAEtB,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAW,CAAC;AAClD,YAAY,EACV,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EACxB,YAAY,GACb,MAAM,oBAAiB,CAAC;AAEzB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,sBAAmB,CAAC;AAC5E,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC"}
|