@xaui/native 0.9.1-alpha.3 → 0.9.1-alpha.31

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.
Files changed (149) hide show
  1. package/dist/chunk-3FV4COTM.js +68 -0
  2. package/dist/chunk-423RQBOX.js +21 -0
  3. package/dist/chunk-42FMGB5M.js +661 -0
  4. package/dist/chunk-4GTAZM2C.js +174 -0
  5. package/dist/chunk-4XPLPQLM.cjs +147 -0
  6. package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
  7. package/dist/chunk-5GO7MAVY.cjs +74 -0
  8. package/dist/chunk-5PTBRJM7.cjs +346 -0
  9. package/dist/chunk-5RQ7AZPN.cjs +455 -0
  10. package/dist/chunk-5Z4P6WHR.cjs +525 -0
  11. package/dist/chunk-7DPL3ZDS.cjs +21 -0
  12. package/dist/chunk-7EIHHOHP.cjs +42 -0
  13. package/dist/chunk-7SEZGVTY.js +62 -0
  14. package/dist/chunk-7XKQJQF2.cjs +70 -0
  15. package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
  16. package/dist/chunk-A5OCK3C2.js +525 -0
  17. package/dist/chunk-AETWQQWU.cjs +92 -0
  18. package/dist/chunk-ANNUYP55.cjs +431 -0
  19. package/dist/chunk-BA2DBSAN.js +102 -0
  20. package/dist/chunk-BFMTUMTU.js +669 -0
  21. package/dist/chunk-BVJQ3UPZ.js +62 -0
  22. package/dist/chunk-DFME724B.js +147 -0
  23. package/dist/chunk-E2CWBQTV.js +119 -0
  24. package/dist/chunk-EGLLDKN6.js +9 -0
  25. package/dist/chunk-EJQCQPET.cjs +9 -0
  26. package/dist/chunk-F6CQ6CBI.cjs +112 -0
  27. package/dist/chunk-F6W3JQ7K.js +42 -0
  28. package/dist/chunk-FNEUOBCV.cjs +174 -0
  29. package/dist/chunk-G7K652GC.js +145 -0
  30. package/dist/chunk-GGW42MY4.js +20 -0
  31. package/dist/chunk-GLGU2WFL.cjs +190 -0
  32. package/dist/chunk-GPVNCJ3Z.cjs +696 -0
  33. package/dist/chunk-GVQOD3VW.js +74 -0
  34. package/dist/chunk-IHOCANCQ.js +293 -0
  35. package/dist/chunk-JDFV4W6N.cjs +700 -0
  36. package/dist/chunk-KOC3KQIT.js +124 -0
  37. package/dist/chunk-KPWZLUES.cjs +124 -0
  38. package/dist/chunk-L7JN6OBQ.cjs +314 -0
  39. package/dist/chunk-MC7SY2QH.cjs +20 -0
  40. package/dist/chunk-MDVSCWJI.js +314 -0
  41. package/dist/chunk-N527BTY4.cjs +366 -0
  42. package/dist/chunk-NYRXUGVL.js +104 -0
  43. package/dist/{chunk-AW63PTQ4.cjs → chunk-OHEHPQLC.cjs} +72 -72
  44. package/dist/chunk-Q3WFY5N3.js +366 -0
  45. package/dist/chunk-QGN2BBJO.cjs +104 -0
  46. package/dist/chunk-RDTKAAHX.js +346 -0
  47. package/dist/chunk-TGZZ3RZU.cjs +86 -0
  48. package/dist/{chunk-2KXQATVL.js → chunk-TZG3DERP.js} +46 -46
  49. package/dist/chunk-URSKA2VR.js +190 -0
  50. package/dist/chunk-V4WDMM6Z.js +86 -0
  51. package/dist/chunk-VJEER76X.js +455 -0
  52. package/dist/chunk-VZBWYWEI.cjs +736 -0
  53. package/dist/chunk-WR7YLDVV.cjs +68 -0
  54. package/dist/chunk-X4HQ4H2V.js +701 -0
  55. package/dist/chunk-XFSW3ZNI.cjs +145 -0
  56. package/dist/chunk-XQFAUDR2.cjs +62 -0
  57. package/dist/chunk-ZH5XVNHG.js +92 -0
  58. package/dist/chunk-ZH6BHLQR.js +431 -0
  59. package/dist/chunk-ZP2E2H2G.cjs +119 -0
  60. package/dist/chunk-ZVWXM3UK.cjs +293 -0
  61. package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
  62. package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
  63. package/dist/components/alert/index.cjs +20 -0
  64. package/dist/components/alert/index.d.cts +169 -0
  65. package/dist/components/alert/index.d.ts +169 -0
  66. package/dist/components/alert/index.js +20 -0
  67. package/dist/components/button/index.cjs +21 -0
  68. package/dist/components/button/index.d.cts +613 -0
  69. package/dist/components/button/index.d.ts +613 -0
  70. package/dist/components/button/index.js +21 -0
  71. package/dist/components/card/index.cjs +22 -0
  72. package/dist/components/card/index.d.cts +620 -0
  73. package/dist/components/card/index.d.ts +620 -0
  74. package/dist/components/card/index.js +22 -0
  75. package/dist/components/checkbox/index.cjs +26 -0
  76. package/dist/components/checkbox/index.d.cts +1136 -0
  77. package/dist/components/checkbox/index.d.ts +1136 -0
  78. package/dist/components/checkbox/index.js +26 -0
  79. package/dist/components/chip/index.cjs +20 -0
  80. package/dist/components/chip/index.d.cts +608 -0
  81. package/dist/components/chip/index.d.ts +608 -0
  82. package/dist/components/chip/index.js +20 -0
  83. package/dist/components/divider/index.cjs +13 -0
  84. package/dist/components/divider/index.d.cts +117 -0
  85. package/dist/components/divider/index.d.ts +117 -0
  86. package/dist/components/divider/index.js +13 -0
  87. package/dist/components/input/index.cjs +25 -0
  88. package/dist/components/input/index.d.cts +205 -0
  89. package/dist/components/input/index.d.ts +205 -0
  90. package/dist/components/input/index.js +25 -0
  91. package/dist/components/input-group/index.cjs +27 -0
  92. package/dist/components/input-group/index.d.cts +270 -0
  93. package/dist/components/input-group/index.d.ts +270 -0
  94. package/dist/components/input-group/index.js +27 -0
  95. package/dist/components/input-otp/index.cjs +29 -0
  96. package/dist/components/input-otp/index.d.cts +325 -0
  97. package/dist/components/input-otp/index.d.ts +325 -0
  98. package/dist/components/input-otp/index.js +29 -0
  99. package/dist/components/radio/index.cjs +26 -0
  100. package/dist/components/radio/index.d.cts +1102 -0
  101. package/dist/components/radio/index.d.ts +1102 -0
  102. package/dist/components/radio/index.js +26 -0
  103. package/dist/components/spinner/index.cjs +16 -0
  104. package/dist/components/spinner/index.d.cts +104 -0
  105. package/dist/components/spinner/index.d.ts +104 -0
  106. package/dist/components/spinner/index.js +16 -0
  107. package/dist/components/switch/index.cjs +27 -0
  108. package/dist/components/switch/index.d.cts +1154 -0
  109. package/dist/components/switch/index.d.ts +1154 -0
  110. package/dist/components/switch/index.js +27 -0
  111. package/dist/components/text-area/index.cjs +14 -0
  112. package/dist/components/text-area/index.d.cts +73 -0
  113. package/dist/components/text-area/index.d.ts +73 -0
  114. package/dist/components/text-area/index.js +14 -0
  115. package/dist/components/typography/index.cjs +15 -0
  116. package/dist/components/typography/index.d.cts +116 -0
  117. package/dist/components/typography/index.d.ts +116 -0
  118. package/dist/components/typography/index.js +15 -0
  119. package/dist/components/view/index.cjs +17 -0
  120. package/dist/components/view/index.d.cts +152 -0
  121. package/dist/components/view/index.d.ts +152 -0
  122. package/dist/components/view/index.js +17 -0
  123. package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
  124. package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
  125. package/dist/icon.type-Kml72iSz.d.ts +73 -0
  126. package/dist/icon.type-d_i9ma-i.d.cts +73 -0
  127. package/dist/index.cjs +252 -4
  128. package/dist/index.d.cts +110 -4
  129. package/dist/index.d.ts +110 -4
  130. package/dist/index.js +271 -23
  131. package/dist/input.type-BUMDlzL9.d.cts +167 -0
  132. package/dist/input.type-D2qgi03E.d.ts +167 -0
  133. package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
  134. package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
  135. package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
  136. package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
  137. package/dist/system/index.cjs +60 -3
  138. package/dist/system/index.d.cts +347 -181
  139. package/dist/system/index.d.ts +347 -181
  140. package/dist/system/index.js +71 -14
  141. package/dist/theme/index.cjs +4 -3
  142. package/dist/theme/index.d.cts +34 -23
  143. package/dist/theme/index.d.ts +34 -23
  144. package/dist/theme/index.js +3 -2
  145. package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
  146. package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
  147. package/package.json +184 -18
  148. package/dist/chunk-QAMNNTGM.js +0 -637
  149. package/dist/chunk-V63JO65F.cjs +0 -637
@@ -0,0 +1,431 @@
1
+ import {
2
+ CloseButton,
3
+ closeButtonBase
4
+ } from "./chunk-V4WDMM6Z.js";
5
+ import {
6
+ PressableFeedback
7
+ } from "./chunk-BFMTUMTU.js";
8
+ import {
9
+ usePressState
10
+ } from "./chunk-423RQBOX.js";
11
+ import {
12
+ warnDev
13
+ } from "./chunk-EGLLDKN6.js";
14
+ import {
15
+ Icon
16
+ } from "./chunk-3FV4COTM.js";
17
+ import {
18
+ createRecipe,
19
+ radiusAxis
20
+ } from "./chunk-4GTAZM2C.js";
21
+ import {
22
+ useXAUITheme
23
+ } from "./chunk-A3EGFI6T.js";
24
+ import {
25
+ Slot,
26
+ childrenToString,
27
+ createSlotContext
28
+ } from "./chunk-E2CWBQTV.js";
29
+ import {
30
+ useStyleProps
31
+ } from "./chunk-URSKA2VR.js";
32
+
33
+ // src/components/chip/chip-avatar.tsx
34
+ import { forwardRef } from "react";
35
+ import { Image, View } from "react-native";
36
+
37
+ // src/components/chip/chip.context.ts
38
+ var [ChipProvider, useChip] = createSlotContext("Chip");
39
+
40
+ // src/components/chip/chip.style.ts
41
+ import { StyleSheet } from "react-native";
42
+ var chipSheet = StyleSheet.create({
43
+ avatarImage: { width: "100%", height: "100%" }
44
+ });
45
+
46
+ // src/components/chip/chip-avatar.tsx
47
+ import { jsx } from "react/jsx-runtime";
48
+ var ChipAvatar = forwardRef(function ChipAvatar2({ children, source, style, ...props }, ref) {
49
+ const { avatarStyle } = useChip();
50
+ const [styleProps, rest] = useStyleProps(props);
51
+ return /* @__PURE__ */ jsx(View, { ref, style: [avatarStyle, styleProps, style], ...rest, children: source ? /* @__PURE__ */ jsx(Image, { source, style: chipSheet.avatarImage }) : children });
52
+ });
53
+ ChipAvatar.displayName = "XAUI.Chip.Avatar";
54
+
55
+ // src/components/chip/chip-close.tsx
56
+ import { forwardRef as forwardRef2 } from "react";
57
+ import { jsx as jsx2 } from "react/jsx-runtime";
58
+ var ChipClose = forwardRef2(function ChipClose2({ isDisabled, ...props }, ref) {
59
+ const { closeStyle, closeGlyphStyle, isDisabled: isChipDisabled } = useChip();
60
+ return /* @__PURE__ */ jsx2(
61
+ CloseButton,
62
+ {
63
+ ref,
64
+ name: "Chip.Close",
65
+ baseStyle: closeStyle,
66
+ glyphStyle: closeGlyphStyle,
67
+ isDisabled: isDisabled ?? isChipDisabled,
68
+ ...props
69
+ }
70
+ );
71
+ });
72
+ ChipClose.displayName = "XAUI.Chip.Close";
73
+
74
+ // src/components/chip/chip-dot.tsx
75
+ import { forwardRef as forwardRef3 } from "react";
76
+ import { View as View2 } from "react-native";
77
+ import { jsx as jsx3 } from "react/jsx-runtime";
78
+ var ChipDot = forwardRef3(function ChipDot2({ style, ...props }, ref) {
79
+ const { dotStyle } = useChip();
80
+ const [styleProps, rest] = useStyleProps(props);
81
+ return /* @__PURE__ */ jsx3(View2, { ref, style: [dotStyle, styleProps, style], ...rest });
82
+ });
83
+ ChipDot.displayName = "XAUI.Chip.Dot";
84
+
85
+ // src/components/chip/chip-icon.tsx
86
+ import { jsx as jsx4 } from "react/jsx-runtime";
87
+ function ChipIcon({ size, color, ...rest }) {
88
+ const { icon } = useChip();
89
+ return /* @__PURE__ */ jsx4(Icon, { size: size ?? icon.size, color: color ?? icon.color, ...rest });
90
+ }
91
+ ChipIcon.displayName = "XAUI.Chip.Icon";
92
+
93
+ // src/components/chip/chip-label.tsx
94
+ import { forwardRef as forwardRef4 } from "react";
95
+ import { Text } from "react-native";
96
+ import { jsx as jsx5 } from "react/jsx-runtime";
97
+ var ChipLabel = forwardRef4(function ChipLabel2({ children, style, numberOfLines = 1, ...props }, ref) {
98
+ const { labelStyle } = useChip();
99
+ const [styleProps, rest] = useStyleProps(props);
100
+ return /* @__PURE__ */ jsx5(
101
+ Text,
102
+ {
103
+ ref,
104
+ numberOfLines,
105
+ style: [labelStyle, styleProps, style],
106
+ ...rest,
107
+ children
108
+ }
109
+ );
110
+ });
111
+ ChipLabel.displayName = "XAUI.Chip.Label";
112
+
113
+ // src/components/chip/chip.tsx
114
+ import { forwardRef as forwardRef5, useMemo } from "react";
115
+ import { StyleSheet as StyleSheet2, View as View3 } from "react-native";
116
+
117
+ // src/components/chip/chip.recipe.ts
118
+ var SLOTS = [
119
+ "root",
120
+ "label",
121
+ "icon",
122
+ "dot",
123
+ "avatar",
124
+ "close",
125
+ "closeGlyph"
126
+ ];
127
+ var VARIANT_TOKENS = {
128
+ primary: { bg: "accent", bgPressed: "accentPressed", fg: "accentForeground" },
129
+ secondary: {
130
+ bg: "accentSoft",
131
+ bgPressed: "accentSoftPressed",
132
+ fg: "accentSoftForeground"
133
+ },
134
+ default: { bg: "default", bgPressed: "defaultPressed", fg: "defaultForeground" },
135
+ tertiary: { border: "border", bgPressed: "defaultSoftPressed", fg: "foreground" },
136
+ ghost: { bgPressed: "defaultSoftPressed", fg: "foreground" },
137
+ success: { bg: "success", bgPressed: "successPressed", fg: "successForeground" },
138
+ "success-soft": {
139
+ bg: "successSoft",
140
+ bgPressed: "successSoftPressed",
141
+ fg: "successSoftForeground"
142
+ },
143
+ warning: { bg: "warning", bgPressed: "warningPressed", fg: "warningForeground" },
144
+ "warning-soft": {
145
+ bg: "warningSoft",
146
+ bgPressed: "warningSoftPressed",
147
+ fg: "warningSoftForeground"
148
+ },
149
+ danger: { bg: "danger", bgPressed: "dangerPressed", fg: "dangerForeground" },
150
+ "danger-soft": {
151
+ bg: "dangerSoft",
152
+ bgPressed: "dangerSoftPressed",
153
+ fg: "dangerSoftForeground"
154
+ }
155
+ };
156
+ function sizeAxis(step) {
157
+ const { height, padding, gap, label, glyph, dot, avatar, cross } = step;
158
+ return (theme) => {
159
+ const diameter = theme.spacing(avatar);
160
+ const box = theme.fontSizes[glyph];
161
+ const inset = theme.spacing(padding);
162
+ const cap = (theme.spacing(height) - diameter) / 2;
163
+ return {
164
+ root: {
165
+ height: theme.spacing(height),
166
+ paddingHorizontal: inset,
167
+ gap: theme.spacing(gap)
168
+ },
169
+ label: {
170
+ fontSize: theme.fontSizes[label],
171
+ lineHeight: theme.lineHeights[label]
172
+ },
173
+ icon: { fontSize: box },
174
+ dot: circle(theme.spacing(dot)),
175
+ avatar: {
176
+ ...circle(diameter),
177
+ // **The one margin on a slot in this component**, and R4 is about spacing between
178
+ // slots — this is not that. The root's horizontal padding is set for text, several
179
+ // times the gap the height leaves above the avatar, so a face sits visibly pushed
180
+ // into the chip while a label beside it looks right. Cancelling the difference
181
+ // seats it in the capsule's rounded end instead. Clamped at zero, because a theme
182
+ // with tighter padding than that gap needs no pull at all.
183
+ //
184
+ // R13 — `marginStart`, so it is the leading edge in RTL too. `Chip.Avatar` is a
185
+ // leading slot by contract, which is what makes a leading-only correction sound.
186
+ marginStart: -Math.max(0, inset - cap)
187
+ },
188
+ // The touch target is the glyph's box; `hitSlop` on the slot is what makes it
189
+ // reachable, because a cross big enough to hit is a cross too big to look right.
190
+ close: { width: box, height: box },
191
+ closeGlyph: { width: theme.spacing(cross) }
192
+ };
193
+ };
194
+ }
195
+ function circle(diameter) {
196
+ return { width: diameter, height: diameter, borderRadius: diameter / 2 };
197
+ }
198
+ var SIZES = {
199
+ xs: {
200
+ height: 5,
201
+ padding: 2,
202
+ gap: 1,
203
+ label: "xs",
204
+ glyph: "sm",
205
+ dot: 1,
206
+ avatar: 3.5,
207
+ cross: 2
208
+ },
209
+ sm: {
210
+ height: 6,
211
+ padding: 2.5,
212
+ gap: 1,
213
+ label: "xs",
214
+ glyph: "sm",
215
+ dot: 1.25,
216
+ avatar: 4.5,
217
+ cross: 2
218
+ },
219
+ md: {
220
+ height: 7,
221
+ padding: 3,
222
+ gap: 1,
223
+ label: "sm",
224
+ glyph: "md",
225
+ dot: 1.5,
226
+ avatar: 5.5,
227
+ cross: 2.5
228
+ },
229
+ lg: {
230
+ height: 9,
231
+ padding: 4,
232
+ gap: 1.5,
233
+ label: "md",
234
+ glyph: "lg",
235
+ dot: 2,
236
+ avatar: 7,
237
+ cross: 3
238
+ }
239
+ };
240
+ var chipRecipe = createRecipe({
241
+ slots: SLOTS,
242
+ // The cross's own geometry — thickness and centring — belongs to the shared
243
+ // `CloseButton`; what stays below is the box and bar size this component's scale sets.
244
+ base: (theme) => ({
245
+ ...closeButtonBase(theme),
246
+ root: {
247
+ // A chip hugs its content where a `Button` fills its column. The difference is what
248
+ // the two are: a button is a control the layout sizes, a chip is a token *about*
249
+ // something, and a tag stretched across a screen has stopped being one. It is also
250
+ // the one line of HeroUI's chip that is not a measurement.
251
+ alignSelf: "flex-start",
252
+ flexDirection: "row",
253
+ alignItems: "center",
254
+ justifyContent: "center",
255
+ borderWidth: 0,
256
+ // The capsule the name means, at every size. HeroUI reaches it through a radius
257
+ // ladder that React Native would clamp to the same pill anyway; saying `full` says
258
+ // it once, and `radius` is still there for the tag that wants square corners.
259
+ borderRadius: theme.radius.full,
260
+ // Squircle corners for when `radius` overrides the pill. Free on Android.
261
+ borderCurve: "continuous"
262
+ // Deliberately no `overflow: 'hidden'`, where HeroUI clips: the press overlays
263
+ // carry their own corners (`system/pressable-feedback/`), so nothing needs the clip
264
+ // — and clipping here would cut a badge or a shadow a caller hangs off the chip.
265
+ },
266
+ label: {
267
+ fontFamily: theme.fontFamilies.body,
268
+ fontWeight: theme.fontWeights.medium
269
+ },
270
+ avatar: { overflow: "hidden", alignItems: "center", justifyContent: "center" }
271
+ }),
272
+ variantTokens: VARIANT_TOKENS,
273
+ /**
274
+ * Where the variant's colours land, for every variant at once. The border width follows
275
+ * the *presence* of the border role rather than a per-variant flag — `tertiary` is the
276
+ * only variant that names one, and that fact is already in the table above.
277
+ *
278
+ * The dot and the cross take the foreground rather than a status token of their own: on
279
+ * a filled `success` chip the readable colour is the one the label already uses, and on
280
+ * a `success-soft` one it is the green that token resolves to. One rule, eleven
281
+ * variants, and a tinted chip gets it for free.
282
+ */
283
+ paint: (theme, colors) => ({
284
+ root: {
285
+ backgroundColor: colors.bg,
286
+ borderColor: colors.border,
287
+ borderWidth: colors.border ? theme.borderWidth.default : 0
288
+ },
289
+ label: { color: colors.fg },
290
+ icon: { color: colors.fg },
291
+ dot: { backgroundColor: colors.fg },
292
+ closeGlyph: { backgroundColor: colors.fg }
293
+ }),
294
+ /** Declaration order is application order: `radius` overrides the capsule `base` set. */
295
+ variants: {
296
+ size: {
297
+ xs: sizeAxis(SIZES.xs),
298
+ sm: sizeAxis(SIZES.sm),
299
+ md: sizeAxis(SIZES.md),
300
+ lg: sizeAxis(SIZES.lg)
301
+ },
302
+ radius: radiusAxis("root")
303
+ },
304
+ /**
305
+ * The pressed colour is the variant's own `…Pressed` token, as on the `Button` and not
306
+ * as on the `Card`: a chip is small enough that a wash over it reads as a smudge, while
307
+ * the fill going one step down reads as the thing itself being pushed. A tinted chip
308
+ * presses through the same OKLab formula as a token one.
309
+ */
310
+ states: {
311
+ pressed: (_theme, colors) => ({ root: { backgroundColor: colors.bgPressed } }),
312
+ disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
313
+ },
314
+ defaultVariants: { variant: "primary", size: "md" }
315
+ });
316
+
317
+ // src/components/chip/chip.tsx
318
+ import { jsx as jsx6 } from "react/jsx-runtime";
319
+ var ChipRoot = forwardRef5(function Chip({
320
+ children,
321
+ variant,
322
+ size,
323
+ radius,
324
+ color,
325
+ isDisabled = false,
326
+ isPressable = false,
327
+ asChild = false,
328
+ accessibilityRole,
329
+ accessibilityState,
330
+ animation,
331
+ style,
332
+ onPressIn,
333
+ onPressOut,
334
+ ...props
335
+ }, ref) {
336
+ const theme = useXAUITheme();
337
+ const [styleProps, rest] = useStyleProps(props);
338
+ const [isPressed, press] = usePressState({ onPressIn, onPressOut });
339
+ const selection = { variant, size, radius };
340
+ const states = { pressed: isPressed, disabled: isDisabled };
341
+ const styles = chipRecipe.resolve({ theme, selection, states });
342
+ const tint = color ? chipRecipe.tint({ theme, color, selection, states }) : void 0;
343
+ const context = useMemo(() => {
344
+ const icon = StyleSheet2.flatten([styles.icon, tint?.icon]);
345
+ return {
346
+ labelStyle: tint ? [styles.label, tint.label] : styles.label,
347
+ dotStyle: tint ? [styles.dot, tint.dot] : styles.dot,
348
+ avatarStyle: styles.avatar,
349
+ closeStyle: styles.close,
350
+ closeGlyphStyle: tint ? [styles.closeGlyph, tint.closeGlyph] : styles.closeGlyph,
351
+ icon: {
352
+ size: icon.fontSize,
353
+ // `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
354
+ // hand to a third-party component expecting a string.
355
+ color: typeof icon.color === "string" ? icon.color : void 0
356
+ },
357
+ isDisabled
358
+ };
359
+ }, [styles, tint, isDisabled]);
360
+ const rootStyle = [
361
+ styles.root,
362
+ tint?.root,
363
+ styleProps,
364
+ typeof style === "function" ? style({ pressed: isPressed }) : style
365
+ ];
366
+ const text = childrenToString(children);
367
+ const content = text !== null ? /* @__PURE__ */ jsx6(ChipLabel, { children: text }) : children;
368
+ if (!isPressable && !asChild && (onPressIn || onPressOut || rest.onPress || rest.onLongPress)) {
369
+ warnDev(
370
+ "Chip: a press handler needs `isPressable`. Without it the chip renders a View, which never receives the touch \u2014 add `isPressable` to make it a control. A `Chip.Close` is its own control and needs neither."
371
+ );
372
+ }
373
+ const surface = isPressable ? /* @__PURE__ */ jsx6(
374
+ PressableFeedback,
375
+ {
376
+ ref,
377
+ isPressed,
378
+ isDisabled,
379
+ asChild,
380
+ animation,
381
+ accessibilityRole: accessibilityRole ?? "button",
382
+ accessibilityState: { disabled: isDisabled, ...accessibilityState },
383
+ ...rest,
384
+ style: rootStyle,
385
+ onPressIn: press.onPressIn,
386
+ onPressOut: press.onPressOut,
387
+ children: asChild ? children : content
388
+ }
389
+ ) : asChild ? (
390
+ // R12 — the caller's element is the chip, so it takes the children it was written
391
+ // with and the auto-wrap does not apply.
392
+ /* @__PURE__ */ jsx6(
393
+ Slot,
394
+ {
395
+ ref,
396
+ accessibilityRole,
397
+ accessibilityState,
398
+ ...rest,
399
+ style: rootStyle,
400
+ children
401
+ }
402
+ )
403
+ ) : /* @__PURE__ */ jsx6(
404
+ View3,
405
+ {
406
+ ref,
407
+ accessibilityRole,
408
+ accessibilityState,
409
+ ...rest,
410
+ style: rootStyle,
411
+ children: content
412
+ }
413
+ );
414
+ return /* @__PURE__ */ jsx6(ChipProvider, { value: context, children: surface });
415
+ });
416
+ ChipRoot.displayName = "XAUI.Chip.Root";
417
+
418
+ // src/components/chip/index.ts
419
+ var Chip2 = Object.assign(ChipRoot, {
420
+ Label: ChipLabel,
421
+ Icon: ChipIcon,
422
+ Dot: ChipDot,
423
+ Avatar: ChipAvatar,
424
+ Close: ChipClose
425
+ });
426
+
427
+ export {
428
+ useChip,
429
+ chipRecipe,
430
+ Chip2 as Chip
431
+ };
@@ -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;