@xaui/native 0.9.1-alpha.4 → 0.9.1-alpha.41
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-2EGR4LWD.js +145 -0
- package/dist/chunk-2NRZKJG7.js +531 -0
- package/dist/chunk-2PMXMKS5.js +67 -0
- package/dist/chunk-2XPG2243.js +586 -0
- package/dist/chunk-36PRYGAM.js +13 -0
- package/dist/chunk-3E7CDKFO.cjs +696 -0
- package/dist/chunk-3GFRSZYR.js +54 -0
- package/dist/chunk-423RQBOX.js +21 -0
- package/dist/chunk-4CUZZWFW.js +92 -0
- package/dist/chunk-4GTAZM2C.js +174 -0
- package/dist/chunk-4KFKWBN5.cjs +89 -0
- package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
- package/dist/chunk-5R26NM4M.cjs +402 -0
- package/dist/chunk-5VKYNBNA.js +607 -0
- package/dist/chunk-64MXEVT3.js +66 -0
- package/dist/chunk-6DOLGZVV.cjs +147 -0
- package/dist/chunk-6L2TS2R3.cjs +92 -0
- package/dist/chunk-6UEZJRVI.js +669 -0
- package/dist/chunk-734MFAX4.js +27 -0
- package/dist/chunk-73RKQC5X.js +104 -0
- package/dist/chunk-7DPL3ZDS.cjs +21 -0
- package/dist/chunk-7EIHHOHP.cjs +42 -0
- package/dist/chunk-7GHM4GKL.cjs +119 -0
- package/dist/chunk-7YF5NAHQ.cjs +74 -0
- package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
- package/dist/chunk-ABAGZTXZ.cjs +736 -0
- package/dist/{chunk-AW63PTQ4.cjs → chunk-ACAPTWE3.cjs} +85 -81
- package/dist/chunk-AMCSSOJT.cjs +104 -0
- package/dist/chunk-BA2DBSAN.js +102 -0
- package/dist/chunk-BRRXFOBY.js +431 -0
- package/dist/chunk-C5YLPCFC.cjs +293 -0
- package/dist/chunk-DA3OKXHV.cjs +700 -0
- package/dist/chunk-DD4276RF.js +366 -0
- package/dist/chunk-DG2I4PJG.js +701 -0
- package/dist/chunk-DHGLGSH6.js +661 -0
- package/dist/chunk-DIBUQ46Y.js +346 -0
- package/dist/chunk-EGLLDKN6.js +9 -0
- package/dist/chunk-EJQCQPET.cjs +9 -0
- package/dist/chunk-EKS3W46M.cjs +66 -0
- package/dist/chunk-EZEYMLO3.js +402 -0
- package/dist/chunk-F6CQ6CBI.cjs +112 -0
- package/dist/chunk-F6W3JQ7K.js +42 -0
- package/dist/chunk-FHUYHV6J.js +89 -0
- package/dist/chunk-FNEUOBCV.cjs +174 -0
- package/dist/chunk-G3CCT4EY.js +518 -0
- package/dist/chunk-G7P3ERYF.cjs +478 -0
- package/dist/chunk-GA6PBWNT.js +147 -0
- package/dist/chunk-GFUZ3MUT.cjs +455 -0
- package/dist/chunk-GGW43Q37.cjs +1 -0
- package/dist/chunk-GTR5X65M.cjs +27 -0
- package/dist/chunk-H4E4HDEP.cjs +13 -0
- package/dist/chunk-H7DS4IO7.js +198 -0
- package/dist/chunk-HDVVZG4S.cjs +198 -0
- package/dist/chunk-IKJVLJKT.js +151 -0
- package/dist/chunk-J3MB4PI5.cjs +531 -0
- package/dist/chunk-K72UDPVN.js +119 -0
- package/dist/chunk-KCMYU7WF.js +86 -0
- package/dist/chunk-LRN3RNDO.js +940 -0
- package/dist/chunk-LTX6TB5I.js +124 -0
- package/dist/chunk-LUPCPLND.cjs +145 -0
- package/dist/chunk-M63GFNKV.js +194 -0
- package/dist/chunk-N3KTZMPG.js +293 -0
- package/dist/chunk-NCTOTTVW.js +13 -0
- package/dist/chunk-NWGLP6JX.cjs +410 -0
- package/dist/chunk-R73XQK7X.cjs +314 -0
- package/dist/chunk-RU7JCMWC.cjs +881 -0
- package/dist/chunk-SNIHUKDA.cjs +184 -0
- package/dist/chunk-T5FV5F7A.cjs +607 -0
- package/dist/chunk-TDTUAIFF.cjs +153 -0
- package/dist/chunk-TJ74XVZN.cjs +431 -0
- package/dist/chunk-TK44VBIE.cjs +194 -0
- package/dist/chunk-UAWBAD4E.cjs +346 -0
- package/dist/chunk-UFTCTTKK.js +381 -0
- package/dist/chunk-VLKBESEV.cjs +407 -0
- package/dist/chunk-WDDXU3OH.cjs +67 -0
- package/dist/chunk-WFEMJCXO.cjs +13 -0
- package/dist/chunk-WHJTBTYM.js +0 -0
- package/dist/{chunk-2KXQATVL.js → chunk-WKCQ6VGW.js} +59 -55
- package/dist/chunk-XFPQFCEK.js +455 -0
- package/dist/chunk-XSQPVDFH.cjs +60 -0
- package/dist/chunk-XTC2SLFT.js +153 -0
- package/dist/chunk-XV735BSA.cjs +366 -0
- package/dist/chunk-XWNG2U4K.cjs +124 -0
- package/dist/chunk-YGYYJ3LQ.js +314 -0
- package/dist/chunk-YVHT2UVW.js +74 -0
- package/dist/chunk-ZFOOJK37.cjs +86 -0
- package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
- package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
- package/dist/components/accordion/index.cjs +35 -0
- package/dist/components/accordion/index.d.cts +299 -0
- package/dist/components/accordion/index.d.ts +299 -0
- package/dist/components/accordion/index.js +35 -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/avatar/index.cjs +16 -0
- package/dist/components/avatar/index.d.cts +131 -0
- package/dist/components/avatar/index.d.ts +131 -0
- package/dist/components/avatar/index.js +16 -0
- package/dist/components/badge/index.cjs +15 -0
- package/dist/components/badge/index.d.cts +157 -0
- package/dist/components/badge/index.d.ts +157 -0
- package/dist/components/badge/index.js +15 -0
- package/dist/components/button/index.cjs +22 -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 +22 -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/divider/index.cjs +13 -0
- package/dist/components/divider/index.d.cts +117 -0
- package/dist/components/divider/index.d.ts +117 -0
- package/dist/components/divider/index.js +13 -0
- package/dist/components/field-group/index.cjs +27 -0
- package/dist/components/field-group/index.d.cts +270 -0
- package/dist/components/field-group/index.d.ts +270 -0
- package/dist/components/field-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/menu/index.cjs +49 -0
- package/dist/components/menu/index.d.cts +351 -0
- package/dist/components/menu/index.d.ts +351 -0
- package/dist/components/menu/index.js +49 -0
- package/dist/components/popover/index.cjs +38 -0
- package/dist/components/popover/index.d.cts +254 -0
- package/dist/components/popover/index.d.ts +254 -0
- package/dist/components/popover/index.js +38 -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/select/index.cjs +50 -0
- package/dist/components/select/index.d.cts +498 -0
- package/dist/components/select/index.d.ts +498 -0
- package/dist/components/select/index.js +50 -0
- package/dist/components/skeleton/index.cjs +11 -0
- package/dist/components/skeleton/index.d.cts +111 -0
- package/dist/components/skeleton/index.d.ts +111 -0
- package/dist/components/skeleton/index.js +11 -0
- package/dist/components/spinner/index.cjs +17 -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 +17 -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/tabs/index.cjs +33 -0
- package/dist/components/tabs/index.d.cts +261 -0
- package/dist/components/tabs/index.d.ts +261 -0
- package/dist/components/tabs/index.js +33 -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/text-field/index.cjs +25 -0
- package/dist/components/text-field/index.d.cts +205 -0
- package/dist/components/text-field/index.d.ts +205 -0
- package/dist/components/text-field/index.js +25 -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 +423 -5
- package/dist/index.d.cts +119 -4
- package/dist/index.d.ts +119 -4
- package/dist/index.js +445 -27
- package/dist/placement-DHa0Rrh1.d.cts +38 -0
- package/dist/placement-DHa0Rrh1.d.ts +38 -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 +73 -4
- package/dist/system/index.d.cts +379 -193
- package/dist/system/index.d.ts +379 -193
- package/dist/system/index.js +87 -18
- package/dist/text-field.type-0l73acce.d.ts +167 -0
- package/dist/text-field.type-DBh06DU5.d.cts +167 -0
- package/dist/theme/index.cjs +5 -3
- package/dist/theme/index.d.cts +55 -24
- package/dist/theme/index.d.ts +55 -24
- package/dist/theme/index.js +4 -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 +264 -18
- package/dist/chunk-ECDWSSHJ.js +0 -688
- package/dist/chunk-IYFGO523.cjs +0 -688
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunkGTR5X65Mcjs = require('./chunk-GTR5X65M.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkLUPCPLNDcjs = require('./chunk-LUPCPLND.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkWDDXU3OHcjs = require('./chunk-WDDXU3OH.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkEKS3W46Mcjs = require('./chunk-EKS3W46M.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkWFEMJCXOcjs = require('./chunk-WFEMJCXO.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunk4KFKWBN5cjs = require('./chunk-4KFKWBN5.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
var _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var _chunk3E7CDKFOcjs = require('./chunk-3E7CDKFO.cjs');
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var _chunk7DPL3ZDScjs = require('./chunk-7DPL3ZDS.cjs');
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
|
|
44
|
+
|
|
45
|
+
// src/components/menu/menu-content.tsx
|
|
46
|
+
var _react = require('react');
|
|
47
|
+
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
48
|
+
|
|
49
|
+
// src/components/menu/menu.recipe.ts
|
|
50
|
+
var _reactnative = require('react-native');
|
|
51
|
+
var SLOTS = [
|
|
52
|
+
"trigger",
|
|
53
|
+
"overlay",
|
|
54
|
+
"content",
|
|
55
|
+
"label",
|
|
56
|
+
"separator",
|
|
57
|
+
"group",
|
|
58
|
+
"item",
|
|
59
|
+
"itemTitle",
|
|
60
|
+
"itemDescription",
|
|
61
|
+
"itemIndicator"
|
|
62
|
+
];
|
|
63
|
+
var VARIANT_TOKENS = {
|
|
64
|
+
default: { fg: "overlayForeground" },
|
|
65
|
+
danger: { fg: "danger" }
|
|
66
|
+
};
|
|
67
|
+
function menuMeasure(fontSize) {
|
|
68
|
+
return fontSize * 15;
|
|
69
|
+
}
|
|
70
|
+
var PANEL_PADDING_HORIZONTAL = 1.5;
|
|
71
|
+
var PANEL_PADDING_VERTICAL = 3;
|
|
72
|
+
var ITEM_PADDING_HORIZONTAL = 2.5;
|
|
73
|
+
var ITEM_PADDING_VERTICAL = 2;
|
|
74
|
+
var ITEM_GAP = 2.5;
|
|
75
|
+
var LABEL_INSET = 3;
|
|
76
|
+
var INDICATOR = 5;
|
|
77
|
+
var HAIRLINE = _reactnative.StyleSheet.hairlineWidth;
|
|
78
|
+
var menuRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
|
|
79
|
+
slots: SLOTS,
|
|
80
|
+
base: (theme) => ({
|
|
81
|
+
overlay: { position: "absolute", top: 0, bottom: 0, start: 0, end: 0 },
|
|
82
|
+
content: {
|
|
83
|
+
position: "absolute",
|
|
84
|
+
backgroundColor: theme.colors.overlay,
|
|
85
|
+
paddingHorizontal: theme.spacing(PANEL_PADDING_HORIZONTAL),
|
|
86
|
+
paddingVertical: theme.spacing(PANEL_PADDING_VERTICAL),
|
|
87
|
+
// Their `--radius-3xl` on a base of 8 is 24; our base is 12, so the same 24 is `2xl`.
|
|
88
|
+
borderRadius: theme.radius["2xl"],
|
|
89
|
+
borderCurve: "continuous",
|
|
90
|
+
...theme.shadows.overlay
|
|
91
|
+
},
|
|
92
|
+
label: {
|
|
93
|
+
fontFamily: theme.fontFamilies.body,
|
|
94
|
+
fontWeight: theme.fontWeights.medium,
|
|
95
|
+
fontSize: theme.fontSizes.sm,
|
|
96
|
+
lineHeight: theme.lineHeights.sm,
|
|
97
|
+
color: theme.colors.muted,
|
|
98
|
+
// Inset to the row's own text rather than to the panel: a heading that starts
|
|
99
|
+
// before the rows it heads reads as a heading for the panel.
|
|
100
|
+
marginStart: theme.spacing(LABEL_INSET),
|
|
101
|
+
paddingVertical: theme.spacing(1)
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* A rule between two runs of rows, placed by the caller rather than drawn between
|
|
105
|
+
* every pair. A menu of four related actions wants none; a menu whose last row is
|
|
106
|
+
* "Supprimer" wants exactly one, above it.
|
|
107
|
+
*
|
|
108
|
+
* It runs the panel's full inner width rather than lining up with the rows' text: a
|
|
109
|
+
* separator inset to the titles reads as belonging to the row under it, and this one
|
|
110
|
+
* belongs to neither.
|
|
111
|
+
*/
|
|
112
|
+
separator: {
|
|
113
|
+
height: HAIRLINE,
|
|
114
|
+
backgroundColor: theme.colors.separator,
|
|
115
|
+
marginVertical: theme.spacing(1),
|
|
116
|
+
marginHorizontal: -theme.spacing(PANEL_PADDING_HORIZONTAL)
|
|
117
|
+
},
|
|
118
|
+
group: { flexDirection: "column" },
|
|
119
|
+
item: {
|
|
120
|
+
flexDirection: "row",
|
|
121
|
+
alignItems: "center",
|
|
122
|
+
gap: theme.spacing(ITEM_GAP),
|
|
123
|
+
paddingHorizontal: theme.spacing(ITEM_PADDING_HORIZONTAL),
|
|
124
|
+
paddingVertical: theme.spacing(ITEM_PADDING_VERTICAL),
|
|
125
|
+
borderRadius: theme.radius.lg,
|
|
126
|
+
borderCurve: "continuous"
|
|
127
|
+
},
|
|
128
|
+
itemTitle: {
|
|
129
|
+
fontFamily: theme.fontFamilies.body,
|
|
130
|
+
fontWeight: theme.fontWeights.medium,
|
|
131
|
+
fontSize: theme.fontSizes.md,
|
|
132
|
+
lineHeight: theme.lineHeights.md,
|
|
133
|
+
// Grows into the row so an indicator stays pinned to the end, whatever the label's
|
|
134
|
+
// length — but from its **content** size rather than from zero.
|
|
135
|
+
//
|
|
136
|
+
// `flex: 1` is `flexBasis: 0`, and the panel is measured before it has a width: with
|
|
137
|
+
// a basis of zero and no definite width to grow into, the row's content size is
|
|
138
|
+
// nothing and the title collapses. The whole menu measured as a 70-point capsule
|
|
139
|
+
// with no text in it. HeroUI writes `flex: 1` here and gets away with it because
|
|
140
|
+
// their measuring pass hands the panel a definite width; ours asks the panel how
|
|
141
|
+
// wide it wants to be, which is a question a zero basis cannot answer.
|
|
142
|
+
flexGrow: 1,
|
|
143
|
+
flexShrink: 1,
|
|
144
|
+
flexBasis: "auto"
|
|
145
|
+
},
|
|
146
|
+
itemDescription: {
|
|
147
|
+
fontFamily: theme.fontFamilies.body,
|
|
148
|
+
fontSize: theme.fontSizes.sm,
|
|
149
|
+
lineHeight: theme.lineHeights.sm,
|
|
150
|
+
color: theme.colors.muted
|
|
151
|
+
},
|
|
152
|
+
itemIndicator: {
|
|
153
|
+
width: theme.spacing(INDICATOR),
|
|
154
|
+
height: theme.spacing(INDICATOR),
|
|
155
|
+
alignItems: "center",
|
|
156
|
+
justifyContent: "center"
|
|
157
|
+
}
|
|
158
|
+
}),
|
|
159
|
+
variantTokens: VARIANT_TOKENS,
|
|
160
|
+
/** The variant paints the row's text and nothing else. The panel is the theme's. */
|
|
161
|
+
paint: (_theme, colors) => ({
|
|
162
|
+
itemTitle: { color: colors.fg },
|
|
163
|
+
itemIndicator: { color: colors.fg }
|
|
164
|
+
}),
|
|
165
|
+
variants: { radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "content") },
|
|
166
|
+
states: {
|
|
167
|
+
pressed: (theme) => ({
|
|
168
|
+
item: { backgroundColor: theme.colors.defaultSoftPressed }
|
|
169
|
+
}),
|
|
170
|
+
disabled: (theme) => ({ trigger: { opacity: theme.opacity.disabled } })
|
|
171
|
+
},
|
|
172
|
+
defaultVariants: { variant: "default" }
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// src/components/menu/menu.context.ts
|
|
176
|
+
var [MenuProvider, useMenu] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Menu");
|
|
177
|
+
var [MenuItemProvider, useMenuItem] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Menu.Item");
|
|
178
|
+
|
|
179
|
+
// src/components/menu/menu-content.tsx
|
|
180
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
181
|
+
var DEFAULT_OFFSET = 6;
|
|
182
|
+
var DEFAULT_INSETS = {
|
|
183
|
+
top: 12,
|
|
184
|
+
bottom: 12,
|
|
185
|
+
start: 12,
|
|
186
|
+
end: 12
|
|
187
|
+
};
|
|
188
|
+
var MenuContent = _react.forwardRef.call(void 0, function MenuContent2({
|
|
189
|
+
children,
|
|
190
|
+
placement = "bottom",
|
|
191
|
+
align = "center",
|
|
192
|
+
width = "content-fit",
|
|
193
|
+
offset = DEFAULT_OFFSET,
|
|
194
|
+
alignOffset = 0,
|
|
195
|
+
avoidCollisions = true,
|
|
196
|
+
insets,
|
|
197
|
+
style,
|
|
198
|
+
onLayout,
|
|
199
|
+
...props
|
|
200
|
+
}, ref) {
|
|
201
|
+
const context = useMenu();
|
|
202
|
+
const { contentStyle, isOpen, anchor } = context;
|
|
203
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
204
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
205
|
+
const { position, onContentLayout, measuringStyle } = _chunkLUPCPLNDcjs.useAnchoredPosition.call(void 0, {
|
|
206
|
+
anchor,
|
|
207
|
+
isOpen,
|
|
208
|
+
placement,
|
|
209
|
+
align,
|
|
210
|
+
width,
|
|
211
|
+
offset,
|
|
212
|
+
alignOffset,
|
|
213
|
+
avoidCollisions,
|
|
214
|
+
insets: { ...DEFAULT_INSETS, ...insets },
|
|
215
|
+
maxWidth: menuMeasure(theme.fontSizes.md),
|
|
216
|
+
onLayout
|
|
217
|
+
});
|
|
218
|
+
if (!isOpen || anchor === null) return null;
|
|
219
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWDDXU3OHcjs.Portal, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MenuProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
220
|
+
_reactnativereanimated2.default.View,
|
|
221
|
+
{
|
|
222
|
+
ref,
|
|
223
|
+
entering: position ? _chunkEKS3W46Mcjs.anchoredEntering.call(void 0, position.placement) : void 0,
|
|
224
|
+
exiting: position ? _chunkEKS3W46Mcjs.anchoredExiting.call(void 0, position.placement) : void 0,
|
|
225
|
+
onLayout: onContentLayout,
|
|
226
|
+
...rest,
|
|
227
|
+
style: [
|
|
228
|
+
contentStyle,
|
|
229
|
+
position === null ? measuringStyle : {
|
|
230
|
+
top: position.top,
|
|
231
|
+
start: position.start,
|
|
232
|
+
width: position.width,
|
|
233
|
+
maxHeight: position.maxHeight
|
|
234
|
+
},
|
|
235
|
+
styleProps,
|
|
236
|
+
style
|
|
237
|
+
],
|
|
238
|
+
children
|
|
239
|
+
},
|
|
240
|
+
_nullishCoalesce(_optionalChain([position, 'optionalAccess', _ => _.placement]), () => ( "measuring"))
|
|
241
|
+
) }) });
|
|
242
|
+
});
|
|
243
|
+
MenuContent.displayName = "XAUI.Menu.Content";
|
|
244
|
+
|
|
245
|
+
// src/components/menu/menu-group.tsx
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
var MenuGroup = _react.forwardRef.call(void 0, function MenuGroup2({ children, accessibilityRole = "menu", style, ...props }, ref) {
|
|
250
|
+
const { groupStyle } = useMenu();
|
|
251
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
252
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
253
|
+
_reactnative.View,
|
|
254
|
+
{
|
|
255
|
+
ref,
|
|
256
|
+
accessibilityRole,
|
|
257
|
+
...rest,
|
|
258
|
+
style: [groupStyle, styleProps, style],
|
|
259
|
+
children
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
});
|
|
263
|
+
MenuGroup.displayName = "XAUI.Menu.Group";
|
|
264
|
+
|
|
265
|
+
// src/components/menu/menu-item.tsx
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
var MenuItem = _react.forwardRef.call(void 0, function MenuItem2({
|
|
269
|
+
variant = "default",
|
|
270
|
+
children,
|
|
271
|
+
isDisabled = false,
|
|
272
|
+
closesOnPress = true,
|
|
273
|
+
asChild = false,
|
|
274
|
+
accessibilityRole = "menuitem",
|
|
275
|
+
accessibilityState,
|
|
276
|
+
style,
|
|
277
|
+
onPress,
|
|
278
|
+
onPressIn,
|
|
279
|
+
onPressOut,
|
|
280
|
+
...props
|
|
281
|
+
}, ref) {
|
|
282
|
+
const { itemStyle, itemPressedStyle, glyph, close } = useMenu();
|
|
283
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
284
|
+
const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
285
|
+
const handlePress = _react.useCallback.call(void 0,
|
|
286
|
+
(event) => {
|
|
287
|
+
_optionalChain([onPress, 'optionalCall', _2 => _2(event)]);
|
|
288
|
+
if (closesOnPress) close();
|
|
289
|
+
},
|
|
290
|
+
[close, closesOnPress, onPress]
|
|
291
|
+
);
|
|
292
|
+
const context = _react.useMemo.call(void 0,
|
|
293
|
+
() => ({ variant, isPressed, isDisabled }),
|
|
294
|
+
[variant, isPressed, isDisabled]
|
|
295
|
+
);
|
|
296
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MenuItemProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.IconContext.Provider, { value: glyph[variant], children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
297
|
+
_chunk3E7CDKFOcjs.PressableFeedback,
|
|
298
|
+
{
|
|
299
|
+
ref,
|
|
300
|
+
isPressed,
|
|
301
|
+
isDisabled,
|
|
302
|
+
asChild,
|
|
303
|
+
accessibilityRole,
|
|
304
|
+
accessibilityState: { disabled: isDisabled, ...accessibilityState },
|
|
305
|
+
...rest,
|
|
306
|
+
style: [
|
|
307
|
+
itemStyle,
|
|
308
|
+
isPressed && itemPressedStyle,
|
|
309
|
+
styleProps,
|
|
310
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
311
|
+
],
|
|
312
|
+
onPress: handlePress,
|
|
313
|
+
onPressIn: press.onPressIn,
|
|
314
|
+
onPressOut: press.onPressOut,
|
|
315
|
+
children: typeof children === "function" ? children(context) : children
|
|
316
|
+
}
|
|
317
|
+
) }) });
|
|
318
|
+
});
|
|
319
|
+
MenuItem.displayName = "XAUI.Menu.Item";
|
|
320
|
+
|
|
321
|
+
// src/components/menu/menu-item-description.tsx
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
var MenuItemDescription = _react.forwardRef.call(void 0,
|
|
326
|
+
function MenuItemDescription2({ children, style, ...props }, ref) {
|
|
327
|
+
const { itemDescriptionStyle } = useMenu();
|
|
328
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
329
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, ...rest, style: [itemDescriptionStyle, styleProps, style], children });
|
|
330
|
+
}
|
|
331
|
+
);
|
|
332
|
+
MenuItemDescription.displayName = "XAUI.Menu.ItemDescription";
|
|
333
|
+
|
|
334
|
+
// src/components/menu/menu-item-indicator.tsx
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
var MenuItemIndicator = _react.forwardRef.call(void 0,
|
|
339
|
+
function MenuItemIndicator2({ children, style, ...props }, ref) {
|
|
340
|
+
const { itemIndicatorStyle } = useMenu();
|
|
341
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
342
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, ...rest, style: [itemIndicatorStyle, styleProps, style], children });
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
MenuItemIndicator.displayName = "XAUI.Menu.ItemIndicator";
|
|
346
|
+
|
|
347
|
+
// src/components/menu/menu-item-title.tsx
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
var MenuItemTitle = _react.forwardRef.call(void 0,
|
|
352
|
+
function MenuItemTitle2({ children, numberOfLines = 1, style, ...props }, ref) {
|
|
353
|
+
const { itemTitleStyle } = useMenu();
|
|
354
|
+
const { variant } = useMenuItem();
|
|
355
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
356
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
357
|
+
_reactnative.Text,
|
|
358
|
+
{
|
|
359
|
+
ref,
|
|
360
|
+
numberOfLines,
|
|
361
|
+
...rest,
|
|
362
|
+
style: [itemTitleStyle[variant], styleProps, style],
|
|
363
|
+
children
|
|
364
|
+
}
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
MenuItemTitle.displayName = "XAUI.Menu.ItemTitle";
|
|
369
|
+
|
|
370
|
+
// src/components/menu/menu-label.tsx
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
var MenuLabel = _react.forwardRef.call(void 0, function MenuLabel2({ children, accessibilityRole = "header", style, ...props }, ref) {
|
|
375
|
+
const { labelStyle } = useMenu();
|
|
376
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
377
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
378
|
+
_reactnative.Text,
|
|
379
|
+
{
|
|
380
|
+
ref,
|
|
381
|
+
accessibilityRole,
|
|
382
|
+
...rest,
|
|
383
|
+
style: [labelStyle, styleProps, style],
|
|
384
|
+
children
|
|
385
|
+
}
|
|
386
|
+
);
|
|
387
|
+
});
|
|
388
|
+
MenuLabel.displayName = "XAUI.Menu.Label";
|
|
389
|
+
|
|
390
|
+
// src/components/menu/menu-separator.tsx
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
var MenuSeparator = _react.forwardRef.call(void 0,
|
|
395
|
+
function MenuSeparator2({ style, ...props }, ref) {
|
|
396
|
+
const { separatorStyle } = useMenu();
|
|
397
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
398
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
399
|
+
_reactnative.View,
|
|
400
|
+
{
|
|
401
|
+
ref,
|
|
402
|
+
accessibilityElementsHidden: true,
|
|
403
|
+
importantForAccessibility: "no-hide-descendants",
|
|
404
|
+
...rest,
|
|
405
|
+
style: [separatorStyle, styleProps, style]
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
);
|
|
410
|
+
MenuSeparator.displayName = "XAUI.Menu.Separator";
|
|
411
|
+
|
|
412
|
+
// src/components/menu/menu-overlay.tsx
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
var AnimatedPressable = _reactnativereanimated2.default.createAnimatedComponent(_reactnative.Pressable);
|
|
418
|
+
var MenuOverlay = _react.forwardRef.call(void 0, function MenuOverlay2({ children, isDismissable = true, style, ...props }, ref) {
|
|
419
|
+
const context = useMenu();
|
|
420
|
+
const { overlayStyle, isOpen, close } = context;
|
|
421
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
422
|
+
if (!isOpen) return null;
|
|
423
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWDDXU3OHcjs.Portal, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MenuProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
424
|
+
AnimatedPressable,
|
|
425
|
+
{
|
|
426
|
+
ref,
|
|
427
|
+
entering: _chunkEKS3W46Mcjs.overlayEntering,
|
|
428
|
+
exiting: _chunkEKS3W46Mcjs.overlayExiting,
|
|
429
|
+
accessibilityRole: "none",
|
|
430
|
+
importantForAccessibility: "no",
|
|
431
|
+
onPress: isDismissable ? close : void 0,
|
|
432
|
+
...rest,
|
|
433
|
+
style: [overlayStyle, styleProps, style],
|
|
434
|
+
children
|
|
435
|
+
}
|
|
436
|
+
) }) });
|
|
437
|
+
});
|
|
438
|
+
MenuOverlay.displayName = "XAUI.Menu.Overlay";
|
|
439
|
+
|
|
440
|
+
// src/components/menu/menu-trigger.tsx
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
var MenuTrigger = _react.forwardRef.call(void 0, function MenuTrigger2({
|
|
444
|
+
children,
|
|
445
|
+
asChild = false,
|
|
446
|
+
accessibilityRole = "button",
|
|
447
|
+
accessibilityState,
|
|
448
|
+
style,
|
|
449
|
+
onLayout,
|
|
450
|
+
onPress,
|
|
451
|
+
onPressIn,
|
|
452
|
+
onPressOut,
|
|
453
|
+
...props
|
|
454
|
+
}, ref) {
|
|
455
|
+
const { triggerStyle, isOpen, isDisabled, toggle, setAnchor } = useMenu();
|
|
456
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
457
|
+
const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
458
|
+
const anchor = _chunkGTR5X65Mcjs.useAnchorRef.call(void 0, { isOpen, onAnchor: setAnchor, onLayout });
|
|
459
|
+
const refs = _chunkWFEMJCXOcjs.useMergedRef.call(void 0, anchor.node, ref);
|
|
460
|
+
const handlePress = _react.useCallback.call(void 0,
|
|
461
|
+
(event) => {
|
|
462
|
+
_optionalChain([onPress, 'optionalCall', _3 => _3(event)]);
|
|
463
|
+
anchor.measure();
|
|
464
|
+
toggle();
|
|
465
|
+
},
|
|
466
|
+
[anchor, onPress, toggle]
|
|
467
|
+
);
|
|
468
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
469
|
+
_chunk3E7CDKFOcjs.PressableFeedback,
|
|
470
|
+
{
|
|
471
|
+
ref: refs,
|
|
472
|
+
isPressed,
|
|
473
|
+
isDisabled,
|
|
474
|
+
asChild,
|
|
475
|
+
accessibilityRole,
|
|
476
|
+
accessibilityState: {
|
|
477
|
+
disabled: isDisabled,
|
|
478
|
+
expanded: isOpen,
|
|
479
|
+
...accessibilityState
|
|
480
|
+
},
|
|
481
|
+
...rest,
|
|
482
|
+
onLayout: anchor.onLayout,
|
|
483
|
+
style: [
|
|
484
|
+
triggerStyle,
|
|
485
|
+
styleProps,
|
|
486
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
487
|
+
],
|
|
488
|
+
onPress: handlePress,
|
|
489
|
+
onPressIn: press.onPressIn,
|
|
490
|
+
onPressOut: press.onPressOut,
|
|
491
|
+
children
|
|
492
|
+
}
|
|
493
|
+
);
|
|
494
|
+
});
|
|
495
|
+
MenuTrigger.displayName = "XAUI.Menu.Trigger";
|
|
496
|
+
|
|
497
|
+
// src/components/menu/menu.tsx
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
var VARIANTS = ["default", "danger"];
|
|
502
|
+
function Menu({
|
|
503
|
+
children,
|
|
504
|
+
radius,
|
|
505
|
+
isOpen: controlledOpen,
|
|
506
|
+
defaultOpen = false,
|
|
507
|
+
onOpenChange,
|
|
508
|
+
isDisabled = false
|
|
509
|
+
}) {
|
|
510
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
511
|
+
const [anchor, setAnchor] = _react.useState.call(void 0, null);
|
|
512
|
+
const [isOpen, setOpen] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
|
|
513
|
+
value: controlledOpen,
|
|
514
|
+
defaultValue: defaultOpen,
|
|
515
|
+
onChange: onOpenChange
|
|
516
|
+
});
|
|
517
|
+
const selection = { radius };
|
|
518
|
+
const styles = menuRecipe.resolve({
|
|
519
|
+
theme,
|
|
520
|
+
selection,
|
|
521
|
+
states: { disabled: isDisabled }
|
|
522
|
+
});
|
|
523
|
+
const pressed = menuRecipe.resolve({ theme, selection, states: { pressed: true } });
|
|
524
|
+
const open = _react.useCallback.call(void 0, () => setOpen(true), [setOpen]);
|
|
525
|
+
const close = _react.useCallback.call(void 0, () => setOpen(false), [setOpen]);
|
|
526
|
+
const toggle = _react.useCallback.call(void 0, () => setOpen((current) => !current), [setOpen]);
|
|
527
|
+
const context = _react.useMemo.call(void 0, () => {
|
|
528
|
+
const byVariant = (read) => Object.fromEntries(VARIANTS.map((v) => [v, read(v)]));
|
|
529
|
+
const title = byVariant(
|
|
530
|
+
(variant) => menuRecipe.resolve({ theme, selection: { ...selection, variant } }).itemTitle
|
|
531
|
+
);
|
|
532
|
+
return {
|
|
533
|
+
triggerStyle: styles.trigger,
|
|
534
|
+
overlayStyle: styles.overlay,
|
|
535
|
+
contentStyle: styles.content,
|
|
536
|
+
labelStyle: styles.label,
|
|
537
|
+
separatorStyle: styles.separator,
|
|
538
|
+
groupStyle: styles.group,
|
|
539
|
+
itemStyle: styles.item,
|
|
540
|
+
itemPressedStyle: pressed.item,
|
|
541
|
+
itemTitleStyle: title,
|
|
542
|
+
itemDescriptionStyle: styles.itemDescription,
|
|
543
|
+
itemIndicatorStyle: styles.itemIndicator,
|
|
544
|
+
glyph: byVariant((variant) => {
|
|
545
|
+
const flat = _reactnative.StyleSheet.flatten([title[variant]]);
|
|
546
|
+
return {
|
|
547
|
+
size: flat.fontSize,
|
|
548
|
+
// `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
|
|
549
|
+
// hand to a third-party component expecting a string.
|
|
550
|
+
color: typeof flat.color === "string" ? flat.color : void 0
|
|
551
|
+
};
|
|
552
|
+
}),
|
|
553
|
+
isOpen,
|
|
554
|
+
isDisabled,
|
|
555
|
+
open,
|
|
556
|
+
close,
|
|
557
|
+
toggle,
|
|
558
|
+
anchor,
|
|
559
|
+
setAnchor
|
|
560
|
+
};
|
|
561
|
+
}, [
|
|
562
|
+
styles,
|
|
563
|
+
pressed,
|
|
564
|
+
theme,
|
|
565
|
+
radius,
|
|
566
|
+
isOpen,
|
|
567
|
+
isDisabled,
|
|
568
|
+
open,
|
|
569
|
+
close,
|
|
570
|
+
toggle,
|
|
571
|
+
anchor
|
|
572
|
+
]);
|
|
573
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MenuProvider, { value: context, children });
|
|
574
|
+
}
|
|
575
|
+
Menu.displayName = "XAUI.Menu.Root";
|
|
576
|
+
|
|
577
|
+
// src/components/menu/index.ts
|
|
578
|
+
var Menu2 = Object.assign(Menu, {
|
|
579
|
+
Trigger: MenuTrigger,
|
|
580
|
+
Overlay: MenuOverlay,
|
|
581
|
+
Content: MenuContent,
|
|
582
|
+
Label: MenuLabel,
|
|
583
|
+
Separator: MenuSeparator,
|
|
584
|
+
Group: MenuGroup,
|
|
585
|
+
Item: MenuItem,
|
|
586
|
+
ItemTitle: MenuItemTitle,
|
|
587
|
+
ItemDescription: MenuItemDescription,
|
|
588
|
+
ItemIndicator: MenuItemIndicator
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
exports.menuRecipe = menuRecipe; exports.useMenu = useMenu; exports.useMenuItem = useMenuItem; exports.MenuContent = MenuContent; exports.MenuGroup = MenuGroup; exports.MenuItem = MenuItem; exports.MenuItemDescription = MenuItemDescription; exports.MenuItemIndicator = MenuItemIndicator; exports.MenuItemTitle = MenuItemTitle; exports.MenuLabel = MenuLabel; exports.MenuSeparator = MenuSeparator; exports.MenuOverlay = MenuOverlay; exports.MenuTrigger = MenuTrigger; exports.Menu = Menu; exports.Menu2 = Menu2;
|