@cdx-ui/primitives 0.0.1-beta.79 → 0.0.1-beta.80
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/lib/commonjs/full-window-overlay/index.js +47 -0
- package/lib/commonjs/full-window-overlay/index.js.map +1 -0
- package/lib/commonjs/index.js +36 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/list-item/index.js.map +1 -1
- package/lib/commonjs/portal/index.js +17 -0
- package/lib/commonjs/portal/index.js.map +1 -0
- package/lib/commonjs/portal/portal.js +110 -0
- package/lib/commonjs/portal/portal.js.map +1 -0
- package/lib/commonjs/slot/index.js +133 -11
- package/lib/commonjs/slot/index.js.map +1 -1
- package/lib/commonjs/toast/ToastRoot.js +41 -0
- package/lib/commonjs/toast/ToastRoot.js.map +1 -0
- package/lib/commonjs/toast/context.js +11 -0
- package/lib/commonjs/toast/context.js.map +1 -0
- package/lib/commonjs/toast/index.js +26 -0
- package/lib/commonjs/toast/index.js.map +1 -0
- package/lib/commonjs/toast/types.js +6 -0
- package/lib/commonjs/toast/types.js.map +1 -0
- package/lib/module/full-window-overlay/index.js +43 -0
- package/lib/module/full-window-overlay/index.js.map +1 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/list-item/index.js.map +1 -1
- package/lib/module/portal/index.js +4 -0
- package/lib/module/portal/index.js.map +1 -0
- package/lib/module/portal/portal.js +103 -0
- package/lib/module/portal/portal.js.map +1 -0
- package/lib/module/slot/index.js +132 -1
- package/lib/module/slot/index.js.map +1 -1
- package/lib/module/toast/ToastRoot.js +37 -0
- package/lib/module/toast/ToastRoot.js.map +1 -0
- package/lib/module/toast/context.js +5 -0
- package/lib/module/toast/context.js.map +1 -0
- package/lib/module/toast/index.js +5 -0
- package/lib/module/toast/index.js.map +1 -0
- package/lib/module/toast/types.js +4 -0
- package/lib/module/toast/types.js.map +1 -0
- package/lib/typescript/button/index.d.ts +1 -1
- package/lib/typescript/button/index.d.ts.map +1 -1
- package/lib/typescript/full-window-overlay/index.d.ts +46 -0
- package/lib/typescript/full-window-overlay/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/list-item/index.d.ts +1 -1
- package/lib/typescript/list-item/index.d.ts.map +1 -1
- package/lib/typescript/portal/index.d.ts +2 -0
- package/lib/typescript/portal/index.d.ts.map +1 -0
- package/lib/typescript/portal/portal.d.ts +25 -0
- package/lib/typescript/portal/portal.d.ts.map +1 -0
- package/lib/typescript/slot/index.d.ts +7 -1
- package/lib/typescript/slot/index.d.ts.map +1 -1
- package/lib/typescript/toast/ToastRoot.d.ts +7 -0
- package/lib/typescript/toast/ToastRoot.d.ts.map +1 -0
- package/lib/typescript/toast/context.d.ts +6 -0
- package/lib/typescript/toast/context.d.ts.map +1 -0
- package/lib/typescript/toast/index.d.ts +3 -0
- package/lib/typescript/toast/index.d.ts.map +1 -0
- package/lib/typescript/toast/types.d.ts +16 -0
- package/lib/typescript/toast/types.d.ts.map +1 -0
- package/package.json +2 -3
- package/src/button/index.ts +1 -1
- package/src/full-window-overlay/index.tsx +65 -0
- package/src/index.ts +3 -0
- package/src/list-item/index.ts +0 -1
- package/src/portal/index.ts +1 -0
- package/src/portal/portal.tsx +116 -0
- package/src/slot/index.tsx +162 -0
- package/src/toast/ToastRoot.tsx +39 -0
- package/src/toast/context.tsx +4 -0
- package/src/toast/index.ts +2 -0
- package/src/toast/types.ts +17 -0
- package/src/slot/index.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["portal/index.ts"],"mappings":";;AAAA,cAAc,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useEffect, useSyncExternalStore } from 'react';
|
|
5
|
+
import { Platform } from 'react-native';
|
|
6
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const DEFAULT_PORTAL_HOST = 'FORGE_UI_DEFAULT_HOST_NAME';
|
|
8
|
+
const store = {
|
|
9
|
+
map: new Map().set(DEFAULT_PORTAL_HOST, new Map()),
|
|
10
|
+
listeners: new Set()
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// --------------------------------------------------
|
|
14
|
+
|
|
15
|
+
function emit() {
|
|
16
|
+
for (const cb of store.listeners) cb();
|
|
17
|
+
}
|
|
18
|
+
function getSnapshot() {
|
|
19
|
+
return store.map;
|
|
20
|
+
}
|
|
21
|
+
function subscribe(cb) {
|
|
22
|
+
store.listeners.add(cb);
|
|
23
|
+
return () => {
|
|
24
|
+
store.listeners.delete(cb);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function updatePortal(hostName, name, children) {
|
|
28
|
+
const next = new Map(store.map);
|
|
29
|
+
const portal = next.get(hostName) ?? new Map();
|
|
30
|
+
portal.set(name, children);
|
|
31
|
+
next.set(hostName, portal);
|
|
32
|
+
store.map = next;
|
|
33
|
+
emit();
|
|
34
|
+
}
|
|
35
|
+
function removePortal(hostName, name) {
|
|
36
|
+
const next = new Map(store.map);
|
|
37
|
+
const portal = next.get(hostName) ?? new Map();
|
|
38
|
+
portal.delete(name);
|
|
39
|
+
next.set(hostName, portal);
|
|
40
|
+
store.map = next;
|
|
41
|
+
emit();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// --------------------------------------------------
|
|
45
|
+
|
|
46
|
+
export function PortalHost({
|
|
47
|
+
name = DEFAULT_PORTAL_HOST
|
|
48
|
+
}) {
|
|
49
|
+
const map = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
50
|
+
const portalMap = map.get(name) ?? new Map();
|
|
51
|
+
if (portalMap.size === 0) return null;
|
|
52
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
53
|
+
children: Array.from(portalMap.values())
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// --------------------------------------------------
|
|
58
|
+
|
|
59
|
+
export function Portal({
|
|
60
|
+
name,
|
|
61
|
+
hostName = DEFAULT_PORTAL_HOST,
|
|
62
|
+
children
|
|
63
|
+
}) {
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
updatePortal(hostName, name, children);
|
|
66
|
+
return () => {
|
|
67
|
+
removePortal(hostName, name);
|
|
68
|
+
};
|
|
69
|
+
}, [hostName, name, children]);
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// --------------------------------------------------
|
|
74
|
+
|
|
75
|
+
const ROOT = {
|
|
76
|
+
flex: 1
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @deprecated use `FullWindowOverlay` from `react-native-screens` instead
|
|
81
|
+
* @example
|
|
82
|
+
import { FullWindowOverlay } from "react-native-screens"
|
|
83
|
+
const WindowOverlay = Platform.OS === "ios" ? FullWindowOverlay : Fragment
|
|
84
|
+
// Wrap the `<PortalHost/>` with `<WindowOverlay/>`
|
|
85
|
+
<WindowOverlay><PortalHost/></WindowOverlay>
|
|
86
|
+
*/
|
|
87
|
+
export function useModalPortalRoot() {
|
|
88
|
+
const ref = React.useRef(null);
|
|
89
|
+
const [offset, setSideOffSet] = React.useState(0);
|
|
90
|
+
const onLayout = React.useCallback(() => {
|
|
91
|
+
if (Platform.OS === 'web') return;
|
|
92
|
+
ref.current?.measure((_x, _y, _width, _height, _pageX, pageY) => {
|
|
93
|
+
setSideOffSet(-pageY);
|
|
94
|
+
});
|
|
95
|
+
}, []);
|
|
96
|
+
return {
|
|
97
|
+
ref,
|
|
98
|
+
offset,
|
|
99
|
+
onLayout,
|
|
100
|
+
style: ROOT
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=portal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","useSyncExternalStore","Platform","Fragment","_Fragment","jsx","_jsx","DEFAULT_PORTAL_HOST","store","map","Map","set","listeners","Set","emit","cb","getSnapshot","subscribe","add","delete","updatePortal","hostName","name","children","next","portal","get","removePortal","PortalHost","portalMap","size","Array","from","values","Portal","ROOT","flex","useModalPortalRoot","ref","useRef","offset","setSideOffSet","useState","onLayout","useCallback","OS","current","measure","_x","_y","_width","_height","_pageX","pageY","style"],"sourceRoot":"../../../src","sources":["portal/portal.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,SAAS,EAAEC,oBAAoB,QAAQ,OAAO;AACvD,SAASC,QAAQ,QAAmC,cAAc;AAAC,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAEnE,MAAMC,mBAAmB,GAAG,4BAA4B;AAUxD,MAAMC,KAAkB,GAAG;EACzBC,GAAG,EAAE,IAAIC,GAAG,CAAoB,CAAC,CAACC,GAAG,CAACJ,mBAAmB,EAAE,IAAIG,GAAG,CAA0B,CAAC,CAAC;EAC9FE,SAAS,EAAE,IAAIC,GAAG,CAAC;AACrB,CAAC;;AAED;;AAEA,SAASC,IAAIA,CAAA,EAAG;EACd,KAAK,MAAMC,EAAE,IAAIP,KAAK,CAACI,SAAS,EAAEG,EAAE,CAAC,CAAC;AACxC;AAEA,SAASC,WAAWA,CAAA,EAAG;EACrB,OAAOR,KAAK,CAACC,GAAG;AAClB;AAEA,SAASQ,SAASA,CAACF,EAAc,EAAE;EACjCP,KAAK,CAACI,SAAS,CAACM,GAAG,CAACH,EAAE,CAAC;EACvB,OAAO,MAAM;IACXP,KAAK,CAACI,SAAS,CAACO,MAAM,CAACJ,EAAE,CAAC;EAC5B,CAAC;AACH;AAEA,SAASK,YAAYA,CAACC,QAAgB,EAAEC,IAAY,EAAEC,QAAyB,EAAE;EAC/E,MAAMC,IAAI,GAAG,IAAId,GAAG,CAACF,KAAK,CAACC,GAAG,CAAC;EAC/B,MAAMgB,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B,SAAS,CAAC,MAAM;IACdoB,YAAY,CAACC,QAAQ,EAAEC,IAAI,EAAEC,QAAQ,CAAC;IACtC,OAAO,MAAM;MACXI,YAAY,CAACN,QAAQ,EAAEC,IAAI,CAAC;IAC9B,CAAC;EACH,CAAC,EAAE,CAACD,QAAQ,EAAEC,IAAI,EAAEC,QAAQ,CAAC,CAAC;EAE9B,OAAO,IAAI;AACb;;AAEA;;AAEA,MAAMY,IAAe,GAAG;EACtBC,IAAI,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAAG;EACnC,MAAMC,GAAG,GAAGvC,KAAK,CAACwC,MAAM,CAAO,IAAI,CAAC;EACpC,MAAM,CAACC,MAAM,EAAEC,aAAa,CAAC,GAAG1C,KAAK,CAAC2C,QAAQ,CAAC,CAAC,CAAC;EAEjD,MAAMC,QAAQ,GAAG5C,KAAK,CAAC6C,WAAW,CAAC,MAAM;IACvC,IAAI1C,QAAQ,CAAC2C,EAAE,KAAK,KAAK,EAAE;IAC3BP,GAAG,CAACQ,OAAO,EAAEC,OAAO,CAAC,CAACC,EAAE,EAAEC,EAAE,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAEC,KAAK,KAAK;MAC/DZ,aAAa,CAAC,CAACY,KAAK,CAAC;IACvB,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACLf,GAAG;IACHE,MAAM;IACNG,QAAQ;IACRW,KAAK,EAAEnB;EACT,CAAC;AACH","ignoreList":[]}
|
package/lib/module/slot/index.js
CHANGED
|
@@ -1,4 +1,135 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/* https://rn-primitives.vercel.app/slot */
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export function Slot(props) {
|
|
8
|
+
const {
|
|
9
|
+
children,
|
|
10
|
+
ref: forwardedRef,
|
|
11
|
+
...restOfProps
|
|
12
|
+
} = props;
|
|
13
|
+
if (! /*#__PURE__*/React.isValidElement(children)) {
|
|
14
|
+
console.log('Slot - Invalid asChild element', children);
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
if (isTextChildren(children)) {
|
|
18
|
+
console.log('Slot - Text children are not supported', children);
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const childrenProps = children.props ?? {};
|
|
22
|
+
if (children.type === React.Fragment) {
|
|
23
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
24
|
+
children: React.Children.toArray(childrenProps.children).map(child => /*#__PURE__*/React.isValidElement(child) ? Slot({
|
|
25
|
+
...restOfProps,
|
|
26
|
+
ref: forwardedRef,
|
|
27
|
+
children: child
|
|
28
|
+
}) : child)
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const {
|
|
32
|
+
ref: childRef,
|
|
33
|
+
...childProps
|
|
34
|
+
} = childrenProps;
|
|
35
|
+
return /*#__PURE__*/React.cloneElement(children, {
|
|
36
|
+
...mergeProps(restOfProps, childProps),
|
|
37
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
Slot.displayName = 'Slot';
|
|
41
|
+
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
43
|
+
function setRef(ref, value) {
|
|
44
|
+
if (typeof ref === 'function') {
|
|
45
|
+
const cleanup = ref(value);
|
|
46
|
+
if (typeof cleanup === 'function') {
|
|
47
|
+
return cleanup;
|
|
48
|
+
}
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (ref != null) {
|
|
52
|
+
ref.current = value;
|
|
53
|
+
return () => {
|
|
54
|
+
ref.current = null;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function composeRefs(...refs) {
|
|
59
|
+
let cleanups = [];
|
|
60
|
+
return node => {
|
|
61
|
+
cleanups.forEach(cleanup => cleanup());
|
|
62
|
+
cleanups = [];
|
|
63
|
+
if (node == null) {
|
|
64
|
+
refs.forEach(ref => {
|
|
65
|
+
if (typeof ref === 'function') {
|
|
66
|
+
ref(null);
|
|
67
|
+
} else if (ref != null) {
|
|
68
|
+
ref.current = null;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
cleanups = refs.map(ref => setRef(ref, node)).filter(cleanup => cleanup != null);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
// TODO: Compare with mergeProps from @react-aria/utils
|
|
77
|
+
function mergeProps(slotProps, childProps) {
|
|
78
|
+
// all child props should override
|
|
79
|
+
const overrideProps = {
|
|
80
|
+
...childProps
|
|
81
|
+
};
|
|
82
|
+
for (const propName in childProps) {
|
|
83
|
+
const slotPropValue = slotProps[propName];
|
|
84
|
+
const childPropValue = childProps[propName];
|
|
85
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
86
|
+
if (isHandler) {
|
|
87
|
+
// if the handler exists on both, we compose them
|
|
88
|
+
if (slotPropValue && childPropValue) {
|
|
89
|
+
overrideProps[propName] = (...args) => {
|
|
90
|
+
childPropValue(...args);
|
|
91
|
+
slotPropValue(...args);
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
// but if it exists only on the slot, we use only this one
|
|
95
|
+
else if (slotPropValue) {
|
|
96
|
+
overrideProps[propName] = slotPropValue;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// if it's `style`, we merge them
|
|
100
|
+
else if (propName === 'style') {
|
|
101
|
+
overrideProps[propName] = combineStyles(slotPropValue, childPropValue);
|
|
102
|
+
} else if (propName === 'className') {
|
|
103
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
...slotProps,
|
|
108
|
+
...overrideProps
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function combineStyles(slotStyle, childValue) {
|
|
112
|
+
if (typeof slotStyle === 'function' && typeof childValue === 'function') {
|
|
113
|
+
return state => {
|
|
114
|
+
return [slotStyle(state), childValue(state)];
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (typeof slotStyle === 'function') {
|
|
118
|
+
return state => {
|
|
119
|
+
return childValue ? [slotStyle(state), childValue] : slotStyle(state);
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
if (typeof childValue === 'function') {
|
|
123
|
+
return state => {
|
|
124
|
+
return slotStyle ? [slotStyle, childValue(state)] : childValue(state);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if (slotStyle && childValue) {
|
|
128
|
+
return [slotStyle, childValue];
|
|
129
|
+
}
|
|
130
|
+
return slotStyle ?? childValue;
|
|
131
|
+
}
|
|
132
|
+
export function isTextChildren(children) {
|
|
133
|
+
return Array.isArray(children) ? children.every(child => typeof child === 'string') : typeof children === 'string';
|
|
134
|
+
}
|
|
4
135
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Slot","isTextChildren"],"sourceRoot":"../../../src","sources":["slot/index.
|
|
1
|
+
{"version":3,"names":["React","Fragment","_Fragment","jsx","_jsx","Slot","props","children","ref","forwardedRef","restOfProps","isValidElement","console","log","isTextChildren","childrenProps","type","Children","toArray","map","child","childRef","childProps","cloneElement","mergeProps","composeRefs","displayName","setRef","value","cleanup","current","refs","cleanups","node","forEach","filter","slotProps","overrideProps","propName","slotPropValue","childPropValue","isHandler","test","args","combineStyles","Boolean","join","slotStyle","childValue","state","Array","isArray","every"],"sourceRoot":"../../../src","sources":["slot/index.tsx"],"mappings":";;AAAA;;AAEA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAC,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,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AAC,EAAED,UAAU,CAAC,GAAGD,SAAS,CAACE,KAAK,CAAC;IACvE,CAAC;EACH;EACA,IAAI,OAAOD,UAAU,KAAK,UAAU,EAAE;IACpC,OAAQC,KAAiC,IAAK;MAC5C,OAAOF,SAAS,GAAG,CAACA,SAAS,EAAEC,UAAU,CAACC,KAAK,CAAC,CAAC,GAAGD,UAAU,CAACC,KAAK,CAAC;IACvE,CAAC;EACH;EAEA,IAAIF,SAAS,IAAIC,UAAU,EAAE;IAC3B,OAAO,CAACD,SAAS,EAAEC,UAAU,CAAC;EAChC;EAEA,OAAOD,SAAS,IAAIC,UAAU;AAChC;AAEA,OAAO,SAASlC,cAAcA,CAC5BP,QAAoF,EACpF;EACA,OAAO2C,KAAK,CAACC,OAAO,CAAC5C,QAAQ,CAAC,GAC1BA,QAAQ,CAAC6C,KAAK,CAAEhC,KAAK,IAAK,OAAOA,KAAK,KAAK,QAAQ,CAAC,GACpD,OAAOb,QAAQ,KAAK,QAAQ;AAClC","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useId } from 'react';
|
|
4
|
+
import { Platform, View } from 'react-native';
|
|
5
|
+
import { Slot } from '../slot';
|
|
6
|
+
import { ToastProvider } from './context';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
export const ToastRoot = /*#__PURE__*/forwardRef(({
|
|
9
|
+
asChild,
|
|
10
|
+
id,
|
|
11
|
+
role = 'status',
|
|
12
|
+
...viewProps
|
|
13
|
+
}, ref) => {
|
|
14
|
+
const generatedId = useId();
|
|
15
|
+
const nativeID = id || generatedId;
|
|
16
|
+
const Comp = asChild ? Slot : View;
|
|
17
|
+
return /*#__PURE__*/_jsx(ToastProvider, {
|
|
18
|
+
value: {
|
|
19
|
+
nativeID
|
|
20
|
+
},
|
|
21
|
+
children: /*#__PURE__*/_jsx(Comp, {
|
|
22
|
+
ref: ref,
|
|
23
|
+
role: role,
|
|
24
|
+
...(Platform.OS !== 'web' && {
|
|
25
|
+
'aria-live': role === 'alert' ? 'assertive' : 'polite',
|
|
26
|
+
'aria-atomic': true
|
|
27
|
+
}),
|
|
28
|
+
...(Platform.OS === 'web' && role === 'alert' && {
|
|
29
|
+
'aria-live': 'assertive'
|
|
30
|
+
}),
|
|
31
|
+
nativeID: nativeID,
|
|
32
|
+
...viewProps
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
ToastRoot.displayName = 'ToastRoot';
|
|
37
|
+
//# sourceMappingURL=ToastRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useId","Platform","View","Slot","ToastProvider","jsx","_jsx","ToastRoot","asChild","id","role","viewProps","ref","generatedId","nativeID","Comp","value","children","OS","displayName"],"sourceRoot":"../../../src","sources":["toast/ToastRoot.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,KAAK,QAAQ,OAAO;AACzC,SAASC,QAAQ,EAAEC,IAAI,QAAQ,cAAc;AAC7C,SAASC,IAAI,QAAQ,SAAS;AAC9B,SAASC,aAAa,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAO1C,OAAO,MAAMC,SAAS,gBAAGR,UAAU,CACjC,CAAC;EAAES,OAAO;EAAEC,EAAE;EAAEC,IAAI,GAAG,QAAQ;EAAE,GAAGC;AAAU,CAAC,EAAEC,GAAG,KAAK;EACvD,MAAMC,WAAW,GAAGb,KAAK,CAAC,CAAC;EAC3B,MAAMc,QAAQ,GAAGL,EAAE,IAAII,WAAW;EAElC,MAAME,IAAI,GAAGP,OAAO,GAAGL,IAAI,GAAGD,IAAI;EAElC,oBACEI,IAAA,CAACF,aAAa;IAACY,KAAK,EAAE;MAAEF;IAAS,CAAE;IAAAG,QAAA,eACjCX,IAAA,CAACS,IAAI;MACHH,GAAG,EAAEA,GAAI;MACTF,IAAI,EAAEA,IAAK;MAAA,IACNT,QAAQ,CAACiB,EAAE,KAAK,KAAK,IAAI;QAC5B,WAAW,EAAER,IAAI,KAAK,OAAO,GAAG,WAAW,GAAG,QAAQ;QACtD,aAAa,EAAE;MACjB,CAAC;MAAA,IACIT,QAAQ,CAACiB,EAAE,KAAK,KAAK,IACxBR,IAAI,KAAK,OAAO,IAAI;QAClB,WAAW,EAAE;MACf,CAAC;MACHI,QAAQ,EAAEA,QAAS;MAAA,GACfH;IAAS,CACd;EAAC,CACW,CAAC;AAEpB,CACF,CAAC;AAEDJ,SAAS,CAACY,WAAW,GAAG,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","ToastProvider","useToastContext"],"sourceRoot":"../../../src","sources":["toast/context.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,eAAe;AAG7C,OAAO,MAAM,CAACC,aAAa,EAAEC,eAAe,CAAC,GAAGF,aAAa,CAAqB,cAAc,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ToastProvider","useToastContext","ToastRoot"],"sourceRoot":"../../../src","sources":["toast/index.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,eAAe,QAAQ,WAAW;AAC1D,SAASC,SAAS,QAA6B,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["toast/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/button/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/button/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the FullWindowOverlay component
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* FullWindowOverlay renders content in a separate native window on iOS,
|
|
7
|
+
* which allows overlays (bottom sheets, dialogs, toasts) to appear above
|
|
8
|
+
* native modals and the keyboard. However, this breaks the React Native
|
|
9
|
+
* element inspector because it attaches to the main window.
|
|
10
|
+
*
|
|
11
|
+
* Set `disableFullWindowOverlay={true}` when you need to use the element
|
|
12
|
+
* inspector during development. Note: when disabled, overlay content will
|
|
13
|
+
* not render above native modals. iOS only; has no effect on Android.
|
|
14
|
+
*/
|
|
15
|
+
export interface FullWindowOverlayProps {
|
|
16
|
+
/**
|
|
17
|
+
* When true, uses a regular View instead of FullWindowOverlay on iOS.
|
|
18
|
+
* Enables element inspector but overlay content won't appear above native modals.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
disableFullWindowOverlay: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Controls whether VoiceOver treats the overlay window as a modal container.
|
|
24
|
+
* When `false`, VoiceOver can still access elements behind the overlay.
|
|
25
|
+
* When `true`, VoiceOver is restricted to elements inside the overlay.
|
|
26
|
+
* @default false
|
|
27
|
+
* @platform ios
|
|
28
|
+
* @unstable This prop maps directly to the native `accessibilityViewIsModal`
|
|
29
|
+
* on the container view and may change in a future react-native-screens release.
|
|
30
|
+
*/
|
|
31
|
+
unstable_accessibilityContainerViewIsModal?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Content to render inside the overlay
|
|
34
|
+
*/
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Wrapper for react-native-screens FullWindowOverlay with optional disable prop.
|
|
39
|
+
*
|
|
40
|
+
* @description
|
|
41
|
+
* On iOS, FullWindowOverlay creates a separate native window for overlay content,
|
|
42
|
+
* which breaks the React Native element inspector. Use `disableFullWindowOverlay`
|
|
43
|
+
* when debugging to render content in the main window instead.
|
|
44
|
+
*/
|
|
45
|
+
export declare function FullWindowOverlay({ disableFullWindowOverlay, unstable_accessibilityContainerViewIsModal, children, }: Readonly<FullWindowOverlayProps>): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/full-window-overlay/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;;;;;;;OAQG;IACH,0CAA0C,CAAC,EAAE,OAAO,CAAC;IACrD;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,wBAAwB,EACxB,0CAAkD,EAClD,QAAQ,GACT,EAAE,QAAQ,CAAC,sBAAsB,CAAC,2CAYlC"}
|
|
@@ -5,6 +5,7 @@ export * from './checkbox';
|
|
|
5
5
|
export * from './dialog';
|
|
6
6
|
export * from './field';
|
|
7
7
|
export * from './form';
|
|
8
|
+
export * from './full-window-overlay';
|
|
8
9
|
export * from './input';
|
|
9
10
|
export * from './otp-input';
|
|
10
11
|
export * from './link';
|
|
@@ -13,6 +14,8 @@ export { type EdgeInsets, OverlayInsetsProvider } from './overlay';
|
|
|
13
14
|
export * from './select';
|
|
14
15
|
export * from './switch';
|
|
15
16
|
export * from './tile';
|
|
17
|
+
export * from './toast';
|
|
18
|
+
export * from './portal';
|
|
16
19
|
export * from './progress-bar';
|
|
17
20
|
export * from './radio';
|
|
18
21
|
export type { InteractionState } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,KAAK,UAAU,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACnE,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,KAAK,UAAU,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACnE,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { IListItemPressablePassthrough, IListItemProps,
|
|
1
|
+
export type { IListItemPressablePassthrough, IListItemProps, ListItemCrossAlign, ListItemSize, } from './types';
|
|
2
2
|
export { ListItemProvider, useListItemContext } from './context';
|
|
3
3
|
export { ListItemRoot, type ListItemRootProps } from './ListItemRoot';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/list-item/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,6BAA6B,EAC7B,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/list-item/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,6BAA6B,EAC7B,cAAc,EACd,kBAAkB,EAClB,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/portal/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type View, type ViewStyle } from 'react-native';
|
|
3
|
+
export declare function PortalHost({ name }: {
|
|
4
|
+
name?: string;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export declare function Portal({ name, hostName, children, }: {
|
|
7
|
+
name: string;
|
|
8
|
+
hostName?: string;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}): null;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated use `FullWindowOverlay` from `react-native-screens` instead
|
|
13
|
+
* @example
|
|
14
|
+
import { FullWindowOverlay } from "react-native-screens"
|
|
15
|
+
const WindowOverlay = Platform.OS === "ios" ? FullWindowOverlay : Fragment
|
|
16
|
+
// Wrap the `<PortalHost/>` with `<WindowOverlay/>`
|
|
17
|
+
<WindowOverlay><PortalHost/></WindowOverlay>
|
|
18
|
+
*/
|
|
19
|
+
export declare function useModalPortalRoot(): {
|
|
20
|
+
ref: React.RefObject<View | null>;
|
|
21
|
+
offset: number;
|
|
22
|
+
onLayout: () => void;
|
|
23
|
+
style: ViewStyle;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=portal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../src/portal/portal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAY,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAsDnE,wBAAgB,UAAU,CAAC,EAAE,IAA0B,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,kDAK3E;AAID,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,QAA8B,EAC9B,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,QASA;AAQD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB;;;;;EAiBjC"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type PressableStateCallbackType } from 'react-native';
|
|
3
|
+
export declare function Slot<T extends React.ElementType>(props: React.ComponentPropsWithRef<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
export declare namespace Slot {
|
|
5
|
+
var displayName: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function isTextChildren(children: React.ReactNode | ((state: PressableStateCallbackType) => React.ReactNode)): boolean;
|
|
2
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/slot/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/slot/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,KAAK,0BAA0B,EAIhC,MAAM,cAAc,CAAC;AAEtB,wBAAgB,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,kDAiCtF;yBAjCe,IAAI;;;AAiJpB,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,0BAA0B,KAAK,KAAK,CAAC,SAAS,CAAC,WAKrF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import type { IToastProps } from './types';
|
|
3
|
+
export interface ToastRootProps extends IToastProps {
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const ToastRoot: import("react").ForwardRefExoticComponent<ToastRootProps & import("react").RefAttributes<View>>;
|
|
7
|
+
//# sourceMappingURL=ToastRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastRoot.d.ts","sourceRoot":"","sources":["../../../src/toast/ToastRoot.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,IAAI,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,SAAS,iGA0BrB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IToastContextValue } from './types';
|
|
2
|
+
export declare const ToastProvider: import("react").FunctionComponent<{
|
|
3
|
+
children: import("react").ReactNode;
|
|
4
|
+
value: IToastContextValue;
|
|
5
|
+
}>, useToastContext: () => IToastContextValue;
|
|
6
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/toast/context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,eAAO,MAAO,aAAa;;;IAAE,eAAe,0BAAqD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native';
|
|
2
|
+
export interface IToastContextValue {
|
|
3
|
+
/** Unique identifier for the toast */
|
|
4
|
+
nativeID: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IToastProps extends ViewProps {
|
|
7
|
+
/** Unique identifier for the toast */
|
|
8
|
+
id?: string;
|
|
9
|
+
/**
|
|
10
|
+
* ARIA role for the toast element.
|
|
11
|
+
* Use `'alert'` for urgent/danger toasts that require assertive announcements.
|
|
12
|
+
* @default 'status'
|
|
13
|
+
*/
|
|
14
|
+
role?: 'status' | 'alert';
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/toast/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,sCAAsC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdx-ui/primitives",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.80",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"module": "lib/module/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -60,8 +60,7 @@
|
|
|
60
60
|
"@react-stately/checkbox": "3.7.4",
|
|
61
61
|
"@react-stately/radio": "3.12.0",
|
|
62
62
|
"@react-stately/toggle": "3.9.4",
|
|
63
|
-
"@
|
|
64
|
-
"@cdx-ui/utils": "0.0.1-beta.79"
|
|
63
|
+
"@cdx-ui/utils": "0.0.1-beta.80"
|
|
65
64
|
},
|
|
66
65
|
"devDependencies": {
|
|
67
66
|
"@types/react": "*",
|
package/src/button/index.ts
CHANGED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import { FullWindowOverlay as NativeFullWindowOverlay } from 'react-native-screens';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Props for the FullWindowOverlay component
|
|
7
|
+
*
|
|
8
|
+
* @description
|
|
9
|
+
* FullWindowOverlay renders content in a separate native window on iOS,
|
|
10
|
+
* which allows overlays (bottom sheets, dialogs, toasts) to appear above
|
|
11
|
+
* native modals and the keyboard. However, this breaks the React Native
|
|
12
|
+
* element inspector because it attaches to the main window.
|
|
13
|
+
*
|
|
14
|
+
* Set `disableFullWindowOverlay={true}` when you need to use the element
|
|
15
|
+
* inspector during development. Note: when disabled, overlay content will
|
|
16
|
+
* not render above native modals. iOS only; has no effect on Android.
|
|
17
|
+
*/
|
|
18
|
+
export interface FullWindowOverlayProps {
|
|
19
|
+
/**
|
|
20
|
+
* When true, uses a regular View instead of FullWindowOverlay on iOS.
|
|
21
|
+
* Enables element inspector but overlay content won't appear above native modals.
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
disableFullWindowOverlay: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Controls whether VoiceOver treats the overlay window as a modal container.
|
|
27
|
+
* When `false`, VoiceOver can still access elements behind the overlay.
|
|
28
|
+
* When `true`, VoiceOver is restricted to elements inside the overlay.
|
|
29
|
+
* @default false
|
|
30
|
+
* @platform ios
|
|
31
|
+
* @unstable This prop maps directly to the native `accessibilityViewIsModal`
|
|
32
|
+
* on the container view and may change in a future react-native-screens release.
|
|
33
|
+
*/
|
|
34
|
+
unstable_accessibilityContainerViewIsModal?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Content to render inside the overlay
|
|
37
|
+
*/
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Wrapper for react-native-screens FullWindowOverlay with optional disable prop.
|
|
43
|
+
*
|
|
44
|
+
* @description
|
|
45
|
+
* On iOS, FullWindowOverlay creates a separate native window for overlay content,
|
|
46
|
+
* which breaks the React Native element inspector. Use `disableFullWindowOverlay`
|
|
47
|
+
* when debugging to render content in the main window instead.
|
|
48
|
+
*/
|
|
49
|
+
export function FullWindowOverlay({
|
|
50
|
+
disableFullWindowOverlay,
|
|
51
|
+
unstable_accessibilityContainerViewIsModal = false,
|
|
52
|
+
children,
|
|
53
|
+
}: Readonly<FullWindowOverlayProps>) {
|
|
54
|
+
if (Platform.OS !== 'ios' || disableFullWindowOverlay) {
|
|
55
|
+
return <>{children}</>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<NativeFullWindowOverlay
|
|
60
|
+
unstable_accessibilityContainerViewIsModal={unstable_accessibilityContainerViewIsModal}
|
|
61
|
+
>
|
|
62
|
+
{children}
|
|
63
|
+
</NativeFullWindowOverlay>
|
|
64
|
+
);
|
|
65
|
+
}
|