@xaui/native 0.9.1-alpha.3 → 0.9.1-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-27ZRTZEE.js +293 -0
- package/dist/chunk-3FV4COTM.js +68 -0
- package/dist/chunk-423RQBOX.js +21 -0
- package/dist/chunk-4GTAZM2C.js +174 -0
- package/dist/chunk-4XPLPQLM.cjs +147 -0
- package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
- package/dist/chunk-5GO7MAVY.cjs +74 -0
- package/dist/chunk-5RQ7AZPN.cjs +455 -0
- package/dist/chunk-5Z4P6WHR.cjs +525 -0
- package/dist/chunk-6RVCGLKZ.js +661 -0
- package/dist/chunk-7DPL3ZDS.cjs +21 -0
- package/dist/chunk-7EIHHOHP.cjs +42 -0
- package/dist/chunk-7SEZGVTY.js +62 -0
- package/dist/chunk-7XKQJQF2.cjs +70 -0
- package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
- package/dist/chunk-A5OCK3C2.js +525 -0
- package/dist/chunk-BA2DBSAN.js +102 -0
- package/dist/chunk-BFMTUMTU.js +669 -0
- package/dist/chunk-BVJQ3UPZ.js +62 -0
- package/dist/chunk-DFME724B.js +147 -0
- package/dist/chunk-E2CWBQTV.js +119 -0
- package/dist/chunk-E4TS6632.cjs +314 -0
- package/dist/chunk-EGLLDKN6.js +9 -0
- package/dist/chunk-EJQCQPET.cjs +9 -0
- package/dist/chunk-F6CQ6CBI.cjs +112 -0
- package/dist/chunk-F6W3JQ7K.js +42 -0
- package/dist/chunk-FMZQW35T.js +431 -0
- package/dist/chunk-FNEUOBCV.cjs +174 -0
- package/dist/chunk-G7K652GC.js +145 -0
- package/dist/chunk-GGW42MY4.js +20 -0
- package/dist/chunk-GI24YJPE.js +314 -0
- package/dist/chunk-GLGU2WFL.cjs +190 -0
- package/dist/chunk-GPVNCJ3Z.cjs +696 -0
- package/dist/chunk-GVQOD3VW.js +74 -0
- package/dist/chunk-KOC3KQIT.js +124 -0
- package/dist/chunk-KPWZLUES.cjs +124 -0
- package/dist/chunk-KWCHSIMI.cjs +293 -0
- package/dist/chunk-MC7SY2QH.cjs +20 -0
- package/dist/chunk-N527BTY4.cjs +366 -0
- package/dist/chunk-NBFWWQFW.cjs +346 -0
- package/dist/chunk-NYRXUGVL.js +104 -0
- package/dist/{chunk-AW63PTQ4.cjs → chunk-OHEHPQLC.cjs} +72 -72
- package/dist/chunk-Q3WFY5N3.js +366 -0
- package/dist/chunk-QGN2BBJO.cjs +104 -0
- package/dist/chunk-TGZZ3RZU.cjs +86 -0
- package/dist/{chunk-2KXQATVL.js → chunk-TZG3DERP.js} +46 -46
- package/dist/chunk-UBQLKIZC.cjs +431 -0
- package/dist/chunk-URSKA2VR.js +190 -0
- package/dist/chunk-V4WDMM6Z.js +86 -0
- package/dist/chunk-VJEER76X.js +455 -0
- package/dist/chunk-VZBWYWEI.cjs +736 -0
- package/dist/chunk-WR7YLDVV.cjs +68 -0
- package/dist/chunk-X4HQ4H2V.js +701 -0
- package/dist/chunk-XFSW3ZNI.cjs +145 -0
- package/dist/chunk-XQFAUDR2.cjs +62 -0
- package/dist/chunk-YKL6XHM6.js +346 -0
- package/dist/chunk-ZP2E2H2G.cjs +119 -0
- package/dist/chunk-ZSLNGBDS.cjs +700 -0
- package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
- package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
- package/dist/components/alert/index.cjs +20 -0
- package/dist/components/alert/index.d.cts +169 -0
- package/dist/components/alert/index.d.ts +169 -0
- package/dist/components/alert/index.js +20 -0
- package/dist/components/button/index.cjs +21 -0
- package/dist/components/button/index.d.cts +613 -0
- package/dist/components/button/index.d.ts +613 -0
- package/dist/components/button/index.js +21 -0
- package/dist/components/card/index.cjs +22 -0
- package/dist/components/card/index.d.cts +620 -0
- package/dist/components/card/index.d.ts +620 -0
- package/dist/components/card/index.js +22 -0
- package/dist/components/checkbox/index.cjs +26 -0
- package/dist/components/checkbox/index.d.cts +1136 -0
- package/dist/components/checkbox/index.d.ts +1136 -0
- package/dist/components/checkbox/index.js +26 -0
- package/dist/components/chip/index.cjs +20 -0
- package/dist/components/chip/index.d.cts +608 -0
- package/dist/components/chip/index.d.ts +608 -0
- package/dist/components/chip/index.js +20 -0
- package/dist/components/input/index.cjs +25 -0
- package/dist/components/input/index.d.cts +205 -0
- package/dist/components/input/index.d.ts +205 -0
- package/dist/components/input/index.js +25 -0
- package/dist/components/input-group/index.cjs +27 -0
- package/dist/components/input-group/index.d.cts +270 -0
- package/dist/components/input-group/index.d.ts +270 -0
- package/dist/components/input-group/index.js +27 -0
- package/dist/components/input-otp/index.cjs +29 -0
- package/dist/components/input-otp/index.d.cts +325 -0
- package/dist/components/input-otp/index.d.ts +325 -0
- package/dist/components/input-otp/index.js +29 -0
- package/dist/components/radio/index.cjs +26 -0
- package/dist/components/radio/index.d.cts +1102 -0
- package/dist/components/radio/index.d.ts +1102 -0
- package/dist/components/radio/index.js +26 -0
- package/dist/components/spinner/index.cjs +16 -0
- package/dist/components/spinner/index.d.cts +104 -0
- package/dist/components/spinner/index.d.ts +104 -0
- package/dist/components/spinner/index.js +16 -0
- package/dist/components/switch/index.cjs +27 -0
- package/dist/components/switch/index.d.cts +1154 -0
- package/dist/components/switch/index.d.ts +1154 -0
- package/dist/components/switch/index.js +27 -0
- package/dist/components/text-area/index.cjs +14 -0
- package/dist/components/text-area/index.d.cts +73 -0
- package/dist/components/text-area/index.d.ts +73 -0
- package/dist/components/text-area/index.js +14 -0
- package/dist/components/typography/index.cjs +15 -0
- package/dist/components/typography/index.d.cts +116 -0
- package/dist/components/typography/index.d.ts +116 -0
- package/dist/components/typography/index.js +15 -0
- package/dist/components/view/index.cjs +17 -0
- package/dist/components/view/index.d.cts +152 -0
- package/dist/components/view/index.d.ts +152 -0
- package/dist/components/view/index.js +17 -0
- package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
- package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
- package/dist/icon.type-Kml72iSz.d.ts +73 -0
- package/dist/icon.type-d_i9ma-i.d.cts +73 -0
- package/dist/index.cjs +246 -4
- package/dist/index.d.cts +109 -4
- package/dist/index.d.ts +109 -4
- package/dist/index.js +266 -24
- package/dist/input.type-BUMDlzL9.d.cts +167 -0
- package/dist/input.type-D2qgi03E.d.ts +167 -0
- package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
- package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
- package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
- package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
- package/dist/system/index.cjs +60 -3
- package/dist/system/index.d.cts +347 -181
- package/dist/system/index.d.ts +347 -181
- package/dist/system/index.js +71 -14
- package/dist/theme/index.cjs +4 -3
- package/dist/theme/index.d.cts +34 -23
- package/dist/theme/index.d.ts +34 -23
- package/dist/theme/index.js +3 -2
- package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
- package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
- package/package.json +174 -18
- package/dist/chunk-QAMNNTGM.js +0 -637
- package/dist/chunk-V63JO65F.cjs +0 -637
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkZP2E2H2Gcjs = require('./chunk-ZP2E2H2G.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkGLGU2WFLcjs = require('./chunk-GLGU2WFL.cjs');
|
|
7
|
+
|
|
8
|
+
// src/components/view/grid.tsx
|
|
9
|
+
var _react = require('react');
|
|
10
|
+
var _reactnative = require('react-native');
|
|
11
|
+
|
|
12
|
+
// src/components/view/grid.context.ts
|
|
13
|
+
|
|
14
|
+
var GridContext = _react.createContext.call(void 0, null);
|
|
15
|
+
var GridProvider = GridContext.Provider;
|
|
16
|
+
function useGrid() {
|
|
17
|
+
const value = _react.useContext.call(void 0, GridContext);
|
|
18
|
+
if (value === null) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
"XAUI: Grid.Item must be rendered inside a Grid \u2014 it spans that grid\u2019s columns, and outside one there is nothing to span."
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
function spanWidth({ cellWidth, columns, gap }, span) {
|
|
26
|
+
const clamped = Math.min(Math.max(Math.floor(span), 1), columns);
|
|
27
|
+
if (cellWidth === void 0) return `${100 / columns * clamped}%`;
|
|
28
|
+
return cellWidth * clamped + gap * (clamped - 1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// src/components/view/grid.tsx
|
|
32
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
33
|
+
var GridRoot = _react.forwardRef.call(void 0, function Grid({ children, columns = 2, gap = 0, style, onLayout, ...props }, ref) {
|
|
34
|
+
const [width, setWidth] = _react.useState.call(void 0, );
|
|
35
|
+
const [styleProps, rest] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
36
|
+
const safeColumns = Math.max(Math.floor(columns), 1);
|
|
37
|
+
const cellWidth = width === void 0 ? void 0 : (width - gap * (safeColumns - 1)) / safeColumns;
|
|
38
|
+
const context = _react.useMemo.call(void 0,
|
|
39
|
+
() => ({ cellWidth, columns: safeColumns, gap }),
|
|
40
|
+
[cellWidth, safeColumns, gap]
|
|
41
|
+
);
|
|
42
|
+
const handleLayout = (event) => {
|
|
43
|
+
const next = event.nativeEvent.layout.width;
|
|
44
|
+
if (next > 0 && next !== width) setWidth(next);
|
|
45
|
+
_optionalChain([onLayout, 'optionalCall', _ => _(event)]);
|
|
46
|
+
};
|
|
47
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, GridProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
48
|
+
_reactnative.View,
|
|
49
|
+
{
|
|
50
|
+
ref,
|
|
51
|
+
onLayout: handleLayout,
|
|
52
|
+
style: [
|
|
53
|
+
{ flexDirection: "row", flexWrap: "wrap", rowGap: gap, columnGap: gap },
|
|
54
|
+
styleProps,
|
|
55
|
+
style
|
|
56
|
+
],
|
|
57
|
+
...rest,
|
|
58
|
+
children: _react.Children.map(
|
|
59
|
+
children,
|
|
60
|
+
(child) => isGridItem(child) ? child : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: { width: spanWidth(context, 1) }, children: child })
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
) });
|
|
64
|
+
});
|
|
65
|
+
GridRoot.displayName = "XAUI.Grid";
|
|
66
|
+
function isGridItem(child) {
|
|
67
|
+
if (child === null || typeof child !== "object") return false;
|
|
68
|
+
const type = child.type;
|
|
69
|
+
return _optionalChain([type, 'optionalAccess', _2 => _2.displayName]) === "XAUI.Grid.Item";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// src/components/view/grid-item.tsx
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
var GridItem = _react.forwardRef.call(void 0, function GridItem2({ children, span = 1, style, ...props }, ref) {
|
|
77
|
+
const grid = useGrid();
|
|
78
|
+
const [styleProps, rest] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
79
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
80
|
+
_reactnative.View,
|
|
81
|
+
{
|
|
82
|
+
ref,
|
|
83
|
+
style: [{ width: spanWidth(grid, span) }, styleProps, style],
|
|
84
|
+
...rest,
|
|
85
|
+
children
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
});
|
|
89
|
+
GridItem.displayName = "XAUI.Grid.Item";
|
|
90
|
+
|
|
91
|
+
// src/components/view/stack.tsx
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
var StackRoot = _react.forwardRef.call(void 0, function Stack({ children, asChild = false, style, ...props }, ref) {
|
|
96
|
+
const [styleProps, rest] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
97
|
+
const Root = asChild ? _chunkZP2E2H2Gcjs.Slot : _reactnative.View;
|
|
98
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style: [{ position: "relative" }, styleProps, style], ...rest, children });
|
|
99
|
+
});
|
|
100
|
+
StackRoot.displayName = "XAUI.Stack";
|
|
101
|
+
|
|
102
|
+
// src/components/view/stack-item.tsx
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
var StackItem = _react.forwardRef.call(void 0, function StackItem2({ children, asChild = false, style, ...props }, ref) {
|
|
107
|
+
const [styleProps, rest] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
108
|
+
const Root = asChild ? _chunkZP2E2H2Gcjs.Slot : _reactnative.View;
|
|
109
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style: [{ position: "absolute" }, styleProps, style], ...rest, children });
|
|
110
|
+
});
|
|
111
|
+
StackItem.displayName = "XAUI.Stack.Item";
|
|
112
|
+
|
|
113
|
+
// src/components/view/row.tsx
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
var Row = _react.forwardRef.call(void 0, function Row2({ children, asChild = false, style, ...props }, ref) {
|
|
118
|
+
const [styleProps, rest] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
119
|
+
const Root = asChild ? _chunkZP2E2H2Gcjs.Slot : _reactnative.View;
|
|
120
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style: [{ flexDirection: "row" }, styleProps, style], ...rest, children });
|
|
121
|
+
});
|
|
122
|
+
Row.displayName = "XAUI.Row";
|
|
123
|
+
|
|
124
|
+
// src/components/view/column.tsx
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
var Column = _react.forwardRef.call(void 0, function Column2({ children, asChild = false, style, ...props }, ref) {
|
|
129
|
+
const [styleProps, rest] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
130
|
+
const Root = asChild ? _chunkZP2E2H2Gcjs.Slot : _reactnative.View;
|
|
131
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style: [{ flexDirection: "column" }, styleProps, style], ...rest, children });
|
|
132
|
+
});
|
|
133
|
+
Column.displayName = "XAUI.Column";
|
|
134
|
+
|
|
135
|
+
// src/components/view/index.ts
|
|
136
|
+
var Stack2 = Object.assign(StackRoot, { Item: StackItem });
|
|
137
|
+
var Grid2 = Object.assign(GridRoot, { Item: GridItem });
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
exports.useGrid = useGrid; exports.Row = Row; exports.Column = Column; exports.Stack = Stack2; exports.Grid = Grid2;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkGLGU2WFLcjs = require('./chunk-GLGU2WFL.cjs');
|
|
4
|
+
|
|
5
|
+
// src/system/portal/portal.tsx
|
|
6
|
+
var _react = require('react');
|
|
7
|
+
|
|
8
|
+
// src/system/portal/portal-context.ts
|
|
9
|
+
|
|
10
|
+
var PortalContext = _react.createContext.call(void 0, null);
|
|
11
|
+
|
|
12
|
+
// src/system/portal/portal.tsx
|
|
13
|
+
function Portal({ children }) {
|
|
14
|
+
const context = _react.useContext.call(void 0, PortalContext);
|
|
15
|
+
const key = _react.useId.call(void 0, );
|
|
16
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
17
|
+
_optionalChain([context, 'optionalAccess', _ => _.addPortal, 'call', _2 => _2(key, children)]);
|
|
18
|
+
}, [children, context, key]);
|
|
19
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
20
|
+
return () => _optionalChain([context, 'optionalAccess', _3 => _3.removePortal, 'call', _4 => _4(key)]);
|
|
21
|
+
}, [context, key]);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
Portal.displayName = "XAUI.Portal";
|
|
25
|
+
|
|
26
|
+
// src/system/portal/portal-host.tsx
|
|
27
|
+
|
|
28
|
+
var _reactnative = require('react-native');
|
|
29
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
30
|
+
var styles = _reactnative.StyleSheet.create({
|
|
31
|
+
container: { flex: 1 }
|
|
32
|
+
});
|
|
33
|
+
function PortalHost({ children, ...props }) {
|
|
34
|
+
const [styleProps] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
35
|
+
const [portals, setPortals] = _react.useState.call(void 0, /* @__PURE__ */ new Map());
|
|
36
|
+
const addPortal = _react.useCallback.call(void 0, (key, element) => {
|
|
37
|
+
setPortals((current) => new Map(current).set(key, element));
|
|
38
|
+
}, []);
|
|
39
|
+
const removePortal = _react.useCallback.call(void 0, (key) => {
|
|
40
|
+
setPortals((current) => {
|
|
41
|
+
if (!current.has(key)) return current;
|
|
42
|
+
const next = new Map(current);
|
|
43
|
+
next.delete(key);
|
|
44
|
+
return next;
|
|
45
|
+
});
|
|
46
|
+
}, []);
|
|
47
|
+
const methods = _react.useMemo.call(void 0,
|
|
48
|
+
() => ({ addPortal, removePortal }),
|
|
49
|
+
[addPortal, removePortal]
|
|
50
|
+
);
|
|
51
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PortalContext.Provider, { value: methods, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: [styles.container, styleProps], children: [
|
|
52
|
+
children,
|
|
53
|
+
Array.from(portals, ([key, element]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Fragment, { children: element }, key))
|
|
54
|
+
] }) });
|
|
55
|
+
}
|
|
56
|
+
PortalHost.displayName = "XAUI.PortalHost";
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
exports.PortalContext = PortalContext; exports.Portal = Portal; exports.PortalHost = PortalHost;
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SelectionFill
|
|
3
|
+
} from "./chunk-BA2DBSAN.js";
|
|
4
|
+
import {
|
|
5
|
+
PressableFeedback
|
|
6
|
+
} from "./chunk-BFMTUMTU.js";
|
|
7
|
+
import {
|
|
8
|
+
usePressState
|
|
9
|
+
} from "./chunk-423RQBOX.js";
|
|
10
|
+
import {
|
|
11
|
+
useControllableState
|
|
12
|
+
} from "./chunk-F6W3JQ7K.js";
|
|
13
|
+
import {
|
|
14
|
+
createRecipe,
|
|
15
|
+
radiusAxis
|
|
16
|
+
} from "./chunk-4GTAZM2C.js";
|
|
17
|
+
import {
|
|
18
|
+
useXAUITheme
|
|
19
|
+
} from "./chunk-A3EGFI6T.js";
|
|
20
|
+
import {
|
|
21
|
+
childrenToString,
|
|
22
|
+
createSlotContext
|
|
23
|
+
} from "./chunk-E2CWBQTV.js";
|
|
24
|
+
import {
|
|
25
|
+
useStyleProps
|
|
26
|
+
} from "./chunk-URSKA2VR.js";
|
|
27
|
+
|
|
28
|
+
// src/components/checkbox/checkbox-indicator.tsx
|
|
29
|
+
import { forwardRef } from "react";
|
|
30
|
+
import { View } from "react-native";
|
|
31
|
+
|
|
32
|
+
// src/components/checkbox/checkbox.context.ts
|
|
33
|
+
var [CheckboxProvider, useCheckbox] = createSlotContext("Checkbox");
|
|
34
|
+
|
|
35
|
+
// src/components/checkbox/checkbox-indicator.tsx
|
|
36
|
+
import { jsx } from "react/jsx-runtime";
|
|
37
|
+
var CheckboxIndicator = forwardRef(
|
|
38
|
+
function CheckboxIndicator2({ children, animation = true, style, ...props }, ref) {
|
|
39
|
+
const { indicatorStyle, fillStyle, isSelected, isIndeterminate } = useCheckbox();
|
|
40
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
41
|
+
const isFilled = isSelected || isIndeterminate;
|
|
42
|
+
const mark = children ?? (isIndeterminate ? /* @__PURE__ */ jsx(Dash, {}) : /* @__PURE__ */ jsx(Check, {}));
|
|
43
|
+
return /* @__PURE__ */ jsx(View, { ref, ...rest, style: [indicatorStyle, styleProps, style], children: /* @__PURE__ */ jsx(SelectionFill, { isVisible: isFilled, style: fillStyle, animation, children: mark }) });
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
CheckboxIndicator.displayName = "XAUI.Checkbox.Indicator";
|
|
47
|
+
function Check() {
|
|
48
|
+
const { checkStyle } = useCheckbox();
|
|
49
|
+
return /* @__PURE__ */ jsx(View, { style: checkStyle });
|
|
50
|
+
}
|
|
51
|
+
function Dash() {
|
|
52
|
+
const { dashStyle } = useCheckbox();
|
|
53
|
+
return /* @__PURE__ */ jsx(View, { style: dashStyle });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/components/checkbox/checkbox-label.tsx
|
|
57
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
58
|
+
import { Text } from "react-native";
|
|
59
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
60
|
+
var CheckboxLabel = forwardRef2(
|
|
61
|
+
function CheckboxLabel2({ children, style, ...props }, ref) {
|
|
62
|
+
const { labelStyle } = useCheckbox();
|
|
63
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
64
|
+
return /* @__PURE__ */ jsx2(Text, { ref, style: [labelStyle, styleProps, style], ...rest, children });
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
CheckboxLabel.displayName = "XAUI.Checkbox.Label";
|
|
68
|
+
|
|
69
|
+
// src/components/checkbox/checkbox.tsx
|
|
70
|
+
import { forwardRef as forwardRef3, useCallback, useMemo } from "react";
|
|
71
|
+
|
|
72
|
+
// src/components/checkbox/checkbox.recipe.ts
|
|
73
|
+
var SLOTS = ["root", "indicator", "fill", "check", "dash", "label"];
|
|
74
|
+
var VARIANT_TOKENS = {
|
|
75
|
+
primary: {
|
|
76
|
+
bg: "fieldBackground",
|
|
77
|
+
border: "fieldBorder",
|
|
78
|
+
bgSelected: "accent",
|
|
79
|
+
fgSelected: "accentForeground"
|
|
80
|
+
},
|
|
81
|
+
// `bg: 'default'` is the neutral *token*, not this variant's name — the two namespaces
|
|
82
|
+
// meet here as they do on the `Input`, and for the same reason: on a card,
|
|
83
|
+
// `fieldBackground` is the card's own colour and the box would vanish into it.
|
|
84
|
+
secondary: {
|
|
85
|
+
bg: "default",
|
|
86
|
+
border: "fieldBorder",
|
|
87
|
+
bgSelected: "accent",
|
|
88
|
+
fgSelected: "accentForeground"
|
|
89
|
+
},
|
|
90
|
+
tertiary: {
|
|
91
|
+
border: "fieldBorder",
|
|
92
|
+
bgSelected: "accent",
|
|
93
|
+
fgSelected: "accentForeground"
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
function sizeAxis(step) {
|
|
97
|
+
const { box, radius, label, gap, stroke } = step;
|
|
98
|
+
return (theme) => {
|
|
99
|
+
const side = theme.spacing(box);
|
|
100
|
+
return {
|
|
101
|
+
root: { gap: theme.spacing(gap) },
|
|
102
|
+
indicator: { width: side, height: side, borderRadius: theme.radius[radius] },
|
|
103
|
+
check: {
|
|
104
|
+
width: side * CHECK_WIDTH,
|
|
105
|
+
height: side * CHECK_HEIGHT,
|
|
106
|
+
borderStartWidth: stroke,
|
|
107
|
+
borderBottomWidth: stroke,
|
|
108
|
+
// An "L" has its ink in one corner, not in the middle of its box, so rotating it
|
|
109
|
+
// about that box's centre leaves the tick sitting low. Rotating by −45° maps a
|
|
110
|
+
// point to `(dy − dx)·√2/2`, and over the two strokes that spans `H` at the top
|
|
111
|
+
// and `H − t − W` at the bottom — an ink centre `(H − t)·√2/4` **below** the box
|
|
112
|
+
// centre, which flexbox then dutifully centres. Lifting by exactly that is what
|
|
113
|
+
// makes the mark look centred rather than measure centred.
|
|
114
|
+
//
|
|
115
|
+
// Both transforms live here, and not half here and half in a sheet, because
|
|
116
|
+
// `transform` is a whole value: the recipe's merge replaces it rather than
|
|
117
|
+
// blending, so a second step would drop the first.
|
|
118
|
+
transform: [
|
|
119
|
+
{ translateY: -((side * CHECK_HEIGHT - stroke) * Math.SQRT2) / 4 },
|
|
120
|
+
{ rotate: "-45deg" }
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
// The third state's mark: the check's long stroke, on its own and level.
|
|
124
|
+
dash: {
|
|
125
|
+
width: side * CHECK_WIDTH,
|
|
126
|
+
height: stroke,
|
|
127
|
+
borderRadius: stroke / 2
|
|
128
|
+
},
|
|
129
|
+
label: {
|
|
130
|
+
fontSize: theme.fontSizes[label],
|
|
131
|
+
lineHeight: theme.lineHeights[label]
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
var CHECK_WIDTH = 0.5;
|
|
137
|
+
var CHECK_HEIGHT = 0.25;
|
|
138
|
+
var SIZES = {
|
|
139
|
+
sm: { box: 5, radius: "sm", gap: 2, label: "sm", stroke: 2 },
|
|
140
|
+
md: { box: 6, radius: "md", gap: 2, label: "md", stroke: 2 },
|
|
141
|
+
lg: { box: 7, radius: "md", gap: 2.5, label: "lg", stroke: 2.5 }
|
|
142
|
+
};
|
|
143
|
+
var checkboxRecipe = createRecipe({
|
|
144
|
+
slots: SLOTS,
|
|
145
|
+
base: (theme) => ({
|
|
146
|
+
root: { flexDirection: "row", alignItems: "center", alignSelf: "flex-start" },
|
|
147
|
+
indicator: {
|
|
148
|
+
alignItems: "center",
|
|
149
|
+
justifyContent: "center",
|
|
150
|
+
borderWidth: theme.borderWidth.field,
|
|
151
|
+
borderCurve: "continuous",
|
|
152
|
+
// The fill is laid inside the box and has to stop at its corners.
|
|
153
|
+
overflow: "hidden"
|
|
154
|
+
},
|
|
155
|
+
// Laid over the box rather than sized to it: the two corners are the indicator's, and
|
|
156
|
+
// an inset of zero is what keeps the fill inside the border it is clipped by.
|
|
157
|
+
fill: {
|
|
158
|
+
position: "absolute",
|
|
159
|
+
top: 0,
|
|
160
|
+
bottom: 0,
|
|
161
|
+
start: 0,
|
|
162
|
+
end: 0,
|
|
163
|
+
alignItems: "center",
|
|
164
|
+
justifyContent: "center"
|
|
165
|
+
},
|
|
166
|
+
label: {
|
|
167
|
+
fontFamily: theme.fontFamilies.body,
|
|
168
|
+
color: theme.colors.foreground
|
|
169
|
+
}
|
|
170
|
+
}),
|
|
171
|
+
variantTokens: VARIANT_TOKENS,
|
|
172
|
+
/**
|
|
173
|
+
* Where the variant's colours land. The border width follows the *presence* of the
|
|
174
|
+
* border role, exactly as on the `Input`.
|
|
175
|
+
*
|
|
176
|
+
* `bgSelected` and `fgSelected` are painted unconditionally, on two slots the indicator
|
|
177
|
+
* only mounts while it is ticked — which is what keeps selection out of the cache key
|
|
178
|
+
* and inside the tint pass at the same time. An axis would have given up the second.
|
|
179
|
+
*/
|
|
180
|
+
paint: (theme, colors) => ({
|
|
181
|
+
indicator: {
|
|
182
|
+
backgroundColor: colors.bg,
|
|
183
|
+
borderColor: colors.border,
|
|
184
|
+
borderWidth: colors.border ? theme.borderWidth.field : 0
|
|
185
|
+
},
|
|
186
|
+
fill: { backgroundColor: colors.bgSelected },
|
|
187
|
+
check: { borderColor: colors.fgSelected },
|
|
188
|
+
dash: { backgroundColor: colors.fgSelected }
|
|
189
|
+
}),
|
|
190
|
+
variants: {
|
|
191
|
+
size: {
|
|
192
|
+
sm: sizeAxis(SIZES.sm),
|
|
193
|
+
md: sizeAxis(SIZES.md),
|
|
194
|
+
lg: sizeAxis(SIZES.lg)
|
|
195
|
+
},
|
|
196
|
+
radius: radiusAxis("indicator"),
|
|
197
|
+
/**
|
|
198
|
+
* Declared after `size` so its border wins. The resting fill is dropped rather than
|
|
199
|
+
* repainted — `undefined` over a colour is what RN reads as "no background" — because
|
|
200
|
+
* a box that is wrong should read as an outline, not as a filled control that happens
|
|
201
|
+
* to be red at the edge. HeroUI reaches the same shape with a compound.
|
|
202
|
+
*/
|
|
203
|
+
isInvalid: {
|
|
204
|
+
true: (theme) => ({
|
|
205
|
+
indicator: { borderColor: theme.colors.danger, backgroundColor: void 0 },
|
|
206
|
+
fill: { backgroundColor: theme.colors.danger },
|
|
207
|
+
check: { borderColor: theme.colors.dangerForeground },
|
|
208
|
+
dash: { backgroundColor: theme.colors.dangerForeground },
|
|
209
|
+
// The label turns with it: on a long form the field that is wrong has to be
|
|
210
|
+
// findable without reading every message.
|
|
211
|
+
label: { color: theme.colors.danger }
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
/** What `primary` adds to a filled box — the `Input`'s compound, on a smaller field. */
|
|
216
|
+
compoundVariants: [
|
|
217
|
+
{
|
|
218
|
+
when: { variant: "primary" },
|
|
219
|
+
style: (theme) => ({ indicator: theme.shadows.field })
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
states: {
|
|
223
|
+
disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
|
|
224
|
+
},
|
|
225
|
+
defaultVariants: { variant: "secondary", size: "md" }
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// src/components/checkbox/checkbox.tsx
|
|
229
|
+
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
230
|
+
var CheckboxRoot = forwardRef3(function Checkbox({
|
|
231
|
+
children,
|
|
232
|
+
variant,
|
|
233
|
+
size,
|
|
234
|
+
radius,
|
|
235
|
+
color,
|
|
236
|
+
isSelected,
|
|
237
|
+
defaultSelected = false,
|
|
238
|
+
onSelectedChange,
|
|
239
|
+
isIndeterminate = false,
|
|
240
|
+
isInvalid = false,
|
|
241
|
+
isDisabled = false,
|
|
242
|
+
asChild = false,
|
|
243
|
+
accessibilityRole,
|
|
244
|
+
accessibilityState,
|
|
245
|
+
animation,
|
|
246
|
+
style,
|
|
247
|
+
onPress,
|
|
248
|
+
onPressIn,
|
|
249
|
+
onPressOut,
|
|
250
|
+
...props
|
|
251
|
+
}, ref) {
|
|
252
|
+
const theme = useXAUITheme();
|
|
253
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
254
|
+
const [isPressed, press] = usePressState({ onPressIn, onPressOut });
|
|
255
|
+
const [selected, setSelected] = useControllableState({
|
|
256
|
+
value: isSelected,
|
|
257
|
+
defaultValue: defaultSelected,
|
|
258
|
+
onChange: onSelectedChange
|
|
259
|
+
});
|
|
260
|
+
const handlePress = useCallback(
|
|
261
|
+
(event) => {
|
|
262
|
+
setSelected((current) => isIndeterminate ? true : !current);
|
|
263
|
+
onPress?.(event);
|
|
264
|
+
},
|
|
265
|
+
[setSelected, isIndeterminate, onPress]
|
|
266
|
+
);
|
|
267
|
+
const selection = {
|
|
268
|
+
variant,
|
|
269
|
+
size,
|
|
270
|
+
radius,
|
|
271
|
+
isInvalid: isInvalid ? "true" : void 0
|
|
272
|
+
};
|
|
273
|
+
const states = { pressed: isPressed, disabled: isDisabled };
|
|
274
|
+
const styles = checkboxRecipe.resolve({ theme, selection, states });
|
|
275
|
+
const tint = color && !isInvalid ? checkboxRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
276
|
+
const context = useMemo(
|
|
277
|
+
() => ({
|
|
278
|
+
// The tint never reaches the box **at rest**, only the two nodes that say the box
|
|
279
|
+
// is ticked. `paint` writes the resting fill from `bg` and the tint pass re-runs
|
|
280
|
+
// `paint`, so applying `tint.indicator` here would paint an unticked box in the
|
|
281
|
+
// caller's brand colour — which reads as ticked, which is the one thing it is not.
|
|
282
|
+
indicatorStyle: styles.indicator,
|
|
283
|
+
fillStyle: tint ? [styles.fill, tint.fill] : styles.fill,
|
|
284
|
+
checkStyle: tint ? [styles.check, tint.check] : styles.check,
|
|
285
|
+
dashStyle: tint ? [styles.dash, tint.dash] : styles.dash,
|
|
286
|
+
labelStyle: styles.label,
|
|
287
|
+
isSelected: selected,
|
|
288
|
+
isIndeterminate,
|
|
289
|
+
isDisabled,
|
|
290
|
+
isInvalid
|
|
291
|
+
}),
|
|
292
|
+
[styles, tint, selected, isIndeterminate, isDisabled, isInvalid]
|
|
293
|
+
);
|
|
294
|
+
const rootStyle = [
|
|
295
|
+
styles.root,
|
|
296
|
+
tint?.root,
|
|
297
|
+
styleProps,
|
|
298
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
299
|
+
];
|
|
300
|
+
const text = childrenToString(children);
|
|
301
|
+
const content = text !== null ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
302
|
+
/* @__PURE__ */ jsx3(CheckboxIndicator, {}),
|
|
303
|
+
/* @__PURE__ */ jsx3(CheckboxLabel, { children: text })
|
|
304
|
+
] }) : children ?? /* @__PURE__ */ jsx3(CheckboxIndicator, {});
|
|
305
|
+
return /* @__PURE__ */ jsx3(CheckboxProvider, { value: context, children: /* @__PURE__ */ jsx3(
|
|
306
|
+
PressableFeedback,
|
|
307
|
+
{
|
|
308
|
+
ref,
|
|
309
|
+
isPressed,
|
|
310
|
+
isDisabled,
|
|
311
|
+
asChild,
|
|
312
|
+
animation,
|
|
313
|
+
accessibilityRole: accessibilityRole ?? "checkbox",
|
|
314
|
+
accessibilityState: {
|
|
315
|
+
// `'mixed'` is the platform's own word for the third state, and it is the only
|
|
316
|
+
// thing that tells a screen reader this box speaks for rows it cannot see.
|
|
317
|
+
checked: isIndeterminate ? "mixed" : selected,
|
|
318
|
+
disabled: isDisabled,
|
|
319
|
+
...accessibilityState
|
|
320
|
+
},
|
|
321
|
+
"aria-invalid": isInvalid,
|
|
322
|
+
...rest,
|
|
323
|
+
style: rootStyle,
|
|
324
|
+
onPress: handlePress,
|
|
325
|
+
onPressIn: press.onPressIn,
|
|
326
|
+
onPressOut: press.onPressOut,
|
|
327
|
+
children: asChild ? children : content
|
|
328
|
+
}
|
|
329
|
+
) });
|
|
330
|
+
});
|
|
331
|
+
CheckboxRoot.displayName = "XAUI.Checkbox.Root";
|
|
332
|
+
|
|
333
|
+
// src/components/checkbox/index.ts
|
|
334
|
+
var Checkbox2 = Object.assign(CheckboxRoot, {
|
|
335
|
+
Indicator: CheckboxIndicator,
|
|
336
|
+
Label: CheckboxLabel
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
export {
|
|
340
|
+
useCheckbox,
|
|
341
|
+
CheckboxIndicator,
|
|
342
|
+
CheckboxLabel,
|
|
343
|
+
checkboxRecipe,
|
|
344
|
+
CheckboxRoot,
|
|
345
|
+
Checkbox2 as Checkbox
|
|
346
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkGLGU2WFLcjs = require('./chunk-GLGU2WFL.cjs');
|
|
4
|
+
|
|
5
|
+
// src/system/slot/create-slot-context.ts
|
|
6
|
+
var _react = require('react');
|
|
7
|
+
function createSlotContext(name) {
|
|
8
|
+
const Context = _react.createContext.call(void 0, null);
|
|
9
|
+
Context.displayName = `XAUI.${name}.Context`;
|
|
10
|
+
function useSlotContext() {
|
|
11
|
+
const value = _react.useContext.call(void 0, Context);
|
|
12
|
+
if (value === null) {
|
|
13
|
+
const error = new Error(
|
|
14
|
+
`XAUI: use${name} must be called inside <${name}>. A slot reads the values its root resolved, so it can only be rendered as a child of one.`
|
|
15
|
+
);
|
|
16
|
+
_optionalChain([Error, 'access', _ => _.captureStackTrace, 'optionalCall', _2 => _2(
|
|
17
|
+
error,
|
|
18
|
+
useSlotContext
|
|
19
|
+
)]);
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
return [Context.Provider, useSlotContext];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// src/system/slot/merge-props.ts
|
|
28
|
+
var EVENT_HANDLER = /^on[A-Z]/;
|
|
29
|
+
function mergeProps(ours, theirs) {
|
|
30
|
+
const merged = { ...ours };
|
|
31
|
+
for (const key of Object.keys(theirs)) {
|
|
32
|
+
const ourValue = ours[key];
|
|
33
|
+
const theirValue = theirs[key];
|
|
34
|
+
if (EVENT_HANDLER.test(key)) {
|
|
35
|
+
merged[key] = composeHandlers(ourValue, theirValue);
|
|
36
|
+
} else if (key === "style") {
|
|
37
|
+
merged[key] = mergeStyles(ourValue, theirValue);
|
|
38
|
+
} else if (key === "ref") {
|
|
39
|
+
merged[key] = _chunkGLGU2WFLcjs.mergeRefs.call(void 0,
|
|
40
|
+
ourValue,
|
|
41
|
+
theirValue
|
|
42
|
+
);
|
|
43
|
+
} else {
|
|
44
|
+
merged[key] = theirValue;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return merged;
|
|
48
|
+
}
|
|
49
|
+
function composeHandlers(ours, theirs) {
|
|
50
|
+
if (typeof ours !== "function") return theirs;
|
|
51
|
+
if (typeof theirs !== "function") return ours;
|
|
52
|
+
return (...args) => {
|
|
53
|
+
;
|
|
54
|
+
ours(...args);
|
|
55
|
+
return theirs(...args);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function mergeStyles(ours, theirs) {
|
|
59
|
+
if (typeof ours === "function" || typeof theirs === "function") {
|
|
60
|
+
return (state) => [
|
|
61
|
+
resolveStyle(ours, state),
|
|
62
|
+
resolveStyle(theirs, state)
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
return [ours, theirs];
|
|
66
|
+
}
|
|
67
|
+
function resolveStyle(style, state) {
|
|
68
|
+
return typeof style === "function" ? style(state) : style;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/system/slot/slot.tsx
|
|
72
|
+
|
|
73
|
+
var Slot = _react.forwardRef.call(void 0, function Slot2({ children, ...ours }, ref) {
|
|
74
|
+
if (!_react.isValidElement.call(void 0, children)) {
|
|
75
|
+
throw new Error(
|
|
76
|
+
"XAUI: asChild expects exactly one React element as its child, and merges the component's props into it. Text, a fragment, several children or none give it nothing to merge into \u2014 drop `asChild` to render the component itself."
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
const child = children;
|
|
80
|
+
const merged = mergeProps(ours, child.props);
|
|
81
|
+
merged.ref = _chunkGLGU2WFLcjs.mergeRefs.call(void 0, ref, refOf(child));
|
|
82
|
+
return _react.cloneElement.call(void 0, child, merged);
|
|
83
|
+
});
|
|
84
|
+
Slot.displayName = "XAUI.Slot";
|
|
85
|
+
function refOf(element) {
|
|
86
|
+
const fromProps = element.props.ref;
|
|
87
|
+
const fromElement = element.ref;
|
|
88
|
+
return _nullishCoalesce(fromProps, () => ( fromElement));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// src/system/slot/children-to-string.ts
|
|
92
|
+
|
|
93
|
+
function childrenToString(children) {
|
|
94
|
+
const text = stringify(children);
|
|
95
|
+
return text === null || text === "" ? null : text;
|
|
96
|
+
}
|
|
97
|
+
function stringify(node) {
|
|
98
|
+
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
99
|
+
if (typeof node === "string") return node;
|
|
100
|
+
if (typeof node === "number") return String(node);
|
|
101
|
+
if (_react.isValidElement.call(void 0, node)) return null;
|
|
102
|
+
if (Array.isArray(node)) {
|
|
103
|
+
let text = "";
|
|
104
|
+
for (const child of node) {
|
|
105
|
+
const part = stringify(child);
|
|
106
|
+
if (part === null) return null;
|
|
107
|
+
text += part;
|
|
108
|
+
}
|
|
109
|
+
return text;
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
exports.createSlotContext = createSlotContext; exports.mergeProps = mergeProps; exports.Slot = Slot; exports.childrenToString = childrenToString;
|