@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.
Files changed (143) hide show
  1. package/dist/chunk-27ZRTZEE.js +293 -0
  2. package/dist/chunk-3FV4COTM.js +68 -0
  3. package/dist/chunk-423RQBOX.js +21 -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-5RQ7AZPN.cjs +455 -0
  9. package/dist/chunk-5Z4P6WHR.cjs +525 -0
  10. package/dist/chunk-6RVCGLKZ.js +661 -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-BA2DBSAN.js +102 -0
  18. package/dist/chunk-BFMTUMTU.js +669 -0
  19. package/dist/chunk-BVJQ3UPZ.js +62 -0
  20. package/dist/chunk-DFME724B.js +147 -0
  21. package/dist/chunk-E2CWBQTV.js +119 -0
  22. package/dist/chunk-E4TS6632.cjs +314 -0
  23. package/dist/chunk-EGLLDKN6.js +9 -0
  24. package/dist/chunk-EJQCQPET.cjs +9 -0
  25. package/dist/chunk-F6CQ6CBI.cjs +112 -0
  26. package/dist/chunk-F6W3JQ7K.js +42 -0
  27. package/dist/chunk-FMZQW35T.js +431 -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-GI24YJPE.js +314 -0
  32. package/dist/chunk-GLGU2WFL.cjs +190 -0
  33. package/dist/chunk-GPVNCJ3Z.cjs +696 -0
  34. package/dist/chunk-GVQOD3VW.js +74 -0
  35. package/dist/chunk-KOC3KQIT.js +124 -0
  36. package/dist/chunk-KPWZLUES.cjs +124 -0
  37. package/dist/chunk-KWCHSIMI.cjs +293 -0
  38. package/dist/chunk-MC7SY2QH.cjs +20 -0
  39. package/dist/chunk-N527BTY4.cjs +366 -0
  40. package/dist/chunk-NBFWWQFW.cjs +346 -0
  41. package/dist/chunk-NYRXUGVL.js +104 -0
  42. package/dist/{chunk-AW63PTQ4.cjs → chunk-OHEHPQLC.cjs} +72 -72
  43. package/dist/chunk-Q3WFY5N3.js +366 -0
  44. package/dist/chunk-QGN2BBJO.cjs +104 -0
  45. package/dist/chunk-TGZZ3RZU.cjs +86 -0
  46. package/dist/{chunk-2KXQATVL.js → chunk-TZG3DERP.js} +46 -46
  47. package/dist/chunk-UBQLKIZC.cjs +431 -0
  48. package/dist/chunk-URSKA2VR.js +190 -0
  49. package/dist/chunk-V4WDMM6Z.js +86 -0
  50. package/dist/chunk-VJEER76X.js +455 -0
  51. package/dist/chunk-VZBWYWEI.cjs +736 -0
  52. package/dist/chunk-WR7YLDVV.cjs +68 -0
  53. package/dist/chunk-X4HQ4H2V.js +701 -0
  54. package/dist/chunk-XFSW3ZNI.cjs +145 -0
  55. package/dist/chunk-XQFAUDR2.cjs +62 -0
  56. package/dist/chunk-YKL6XHM6.js +346 -0
  57. package/dist/chunk-ZP2E2H2G.cjs +119 -0
  58. package/dist/chunk-ZSLNGBDS.cjs +700 -0
  59. package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
  60. package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
  61. package/dist/components/alert/index.cjs +20 -0
  62. package/dist/components/alert/index.d.cts +169 -0
  63. package/dist/components/alert/index.d.ts +169 -0
  64. package/dist/components/alert/index.js +20 -0
  65. package/dist/components/button/index.cjs +21 -0
  66. package/dist/components/button/index.d.cts +613 -0
  67. package/dist/components/button/index.d.ts +613 -0
  68. package/dist/components/button/index.js +21 -0
  69. package/dist/components/card/index.cjs +22 -0
  70. package/dist/components/card/index.d.cts +620 -0
  71. package/dist/components/card/index.d.ts +620 -0
  72. package/dist/components/card/index.js +22 -0
  73. package/dist/components/checkbox/index.cjs +26 -0
  74. package/dist/components/checkbox/index.d.cts +1136 -0
  75. package/dist/components/checkbox/index.d.ts +1136 -0
  76. package/dist/components/checkbox/index.js +26 -0
  77. package/dist/components/chip/index.cjs +20 -0
  78. package/dist/components/chip/index.d.cts +608 -0
  79. package/dist/components/chip/index.d.ts +608 -0
  80. package/dist/components/chip/index.js +20 -0
  81. package/dist/components/input/index.cjs +25 -0
  82. package/dist/components/input/index.d.cts +205 -0
  83. package/dist/components/input/index.d.ts +205 -0
  84. package/dist/components/input/index.js +25 -0
  85. package/dist/components/input-group/index.cjs +27 -0
  86. package/dist/components/input-group/index.d.cts +270 -0
  87. package/dist/components/input-group/index.d.ts +270 -0
  88. package/dist/components/input-group/index.js +27 -0
  89. package/dist/components/input-otp/index.cjs +29 -0
  90. package/dist/components/input-otp/index.d.cts +325 -0
  91. package/dist/components/input-otp/index.d.ts +325 -0
  92. package/dist/components/input-otp/index.js +29 -0
  93. package/dist/components/radio/index.cjs +26 -0
  94. package/dist/components/radio/index.d.cts +1102 -0
  95. package/dist/components/radio/index.d.ts +1102 -0
  96. package/dist/components/radio/index.js +26 -0
  97. package/dist/components/spinner/index.cjs +16 -0
  98. package/dist/components/spinner/index.d.cts +104 -0
  99. package/dist/components/spinner/index.d.ts +104 -0
  100. package/dist/components/spinner/index.js +16 -0
  101. package/dist/components/switch/index.cjs +27 -0
  102. package/dist/components/switch/index.d.cts +1154 -0
  103. package/dist/components/switch/index.d.ts +1154 -0
  104. package/dist/components/switch/index.js +27 -0
  105. package/dist/components/text-area/index.cjs +14 -0
  106. package/dist/components/text-area/index.d.cts +73 -0
  107. package/dist/components/text-area/index.d.ts +73 -0
  108. package/dist/components/text-area/index.js +14 -0
  109. package/dist/components/typography/index.cjs +15 -0
  110. package/dist/components/typography/index.d.cts +116 -0
  111. package/dist/components/typography/index.d.ts +116 -0
  112. package/dist/components/typography/index.js +15 -0
  113. package/dist/components/view/index.cjs +17 -0
  114. package/dist/components/view/index.d.cts +152 -0
  115. package/dist/components/view/index.d.ts +152 -0
  116. package/dist/components/view/index.js +17 -0
  117. package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
  118. package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
  119. package/dist/icon.type-Kml72iSz.d.ts +73 -0
  120. package/dist/icon.type-d_i9ma-i.d.cts +73 -0
  121. package/dist/index.cjs +246 -4
  122. package/dist/index.d.cts +109 -4
  123. package/dist/index.d.ts +109 -4
  124. package/dist/index.js +266 -24
  125. package/dist/input.type-BUMDlzL9.d.cts +167 -0
  126. package/dist/input.type-D2qgi03E.d.ts +167 -0
  127. package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
  128. package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
  129. package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
  130. package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
  131. package/dist/system/index.cjs +60 -3
  132. package/dist/system/index.d.cts +347 -181
  133. package/dist/system/index.d.ts +347 -181
  134. package/dist/system/index.js +71 -14
  135. package/dist/theme/index.cjs +4 -3
  136. package/dist/theme/index.d.cts +34 -23
  137. package/dist/theme/index.d.ts +34 -23
  138. package/dist/theme/index.js +3 -2
  139. package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
  140. package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
  141. package/package.json +174 -18
  142. package/dist/chunk-QAMNNTGM.js +0 -637
  143. package/dist/chunk-V63JO65F.cjs +0 -637
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule ? obj : {
8
+ default: obj
9
+ };
10
+ } // src/system/selection-fill/selection-fill.tsx
11
+ var _reactnative = require('react-native');
12
+ var _reactnativereanimated = require('react-native-reanimated');
13
+ var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
14
+ var _jsxruntime = require('react/jsx-runtime');
15
+ var DURATION = 120;
16
+ var FROM_SCALE = 0.8;
17
+ function SelectionFill({
18
+ isVisible,
19
+ style,
20
+ animation = true,
21
+ children
22
+ }) {
23
+ if (!animation) {
24
+ return isVisible ? /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
25
+ style,
26
+ children
27
+ }) : null;
28
+ }
29
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, AnimatedFill, {
30
+ isVisible,
31
+ style,
32
+ children
33
+ });
34
+ }
35
+ SelectionFill.displayName = "XAUI.SelectionFill";
36
+ const _worklet_11674708088880_init_data = {
37
+ code: "function chunkF6CQ6CBICjs1(){const{_reactnativereanimated,isVisible,DURATION}=this.__closure;return _reactnativereanimated.withTiming.call(void 0,isVisible?1:0,{duration:DURATION});}",
38
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-F6CQ6CBI.cjs",
39
+ sourceMap: "{\"version\":3,\"names\":[\"chunkF6CQ6CBICjs1\",\"_reactnativereanimated\",\"isVisible\",\"DURATION\",\"__closure\",\"withTiming\",\"call\",\"duration\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-F6CQ6CBI.cjs\"],\"mappings\":\"AA2BuE,SAAAA,iBAAMA,CAAA,QAAAC,sBAAA,CAAAC,SAAA,CAAAC,QAAA,OAAAC,SAAA,CAEzE,MAAO,CAAAH,sBAAsB,CAACI,UAAU,CAACC,IAAI,CAAC,IAAK,EAAC,CAAEJ,SAAS,CAAG,CAAC,CAAG,CAAC,CAAE,CAAEK,QAAQ,CAAEJ,QAAS,CAAC,CAAC,CAClG\",\"ignoreList\":[]}"
40
+ };
41
+ const _worklet_9756080511809_init_data = {
42
+ code: "function chunkF6CQ6CBICjs2(){const{progress,FROM_SCALE}=this.__closure;return{opacity:progress.value,transform:[{scale:FROM_SCALE+(1-FROM_SCALE)*progress.value}]};}",
43
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-F6CQ6CBI.cjs",
44
+ sourceMap: "{\"version\":3,\"names\":[\"chunkF6CQ6CBICjs2\",\"progress\",\"FROM_SCALE\",\"__closure\",\"opacity\",\"value\",\"transform\",\"scale\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-F6CQ6CBI.cjs\"],\"mappings\":\"AA+B6E,SAAAA,iBAAMA,CAAA,QAAAC,QAAA,CAAAC,UAAA,OAAAC,SAAA,CAE/E,MAAO,CACLC,OAAO,CAAEH,QAAQ,CAACI,KAAK,CACvBC,SAAS,CAAE,CAAC,CAAEC,KAAK,CAAEL,UAAU,CAAG,CAAC,CAAC,CAAGA,UAAU,EAAID,QAAQ,CAACI,KAAM,CAAC,CACvE,CAAC,CACH\",\"ignoreList\":[]}"
45
+ };
46
+ function AnimatedFill({
47
+ isVisible,
48
+ style,
49
+ children
50
+ }) {
51
+ const progress = _reactnativereanimated.useDerivedValue.call(void 0, function chunkF6CQ6CBICjs1Factory({
52
+ _worklet_11674708088880_init_data,
53
+ _reactnativereanimated,
54
+ isVisible,
55
+ DURATION
56
+ }) {
57
+ const _e = [new global.Error(), -4, -27];
58
+ const chunkF6CQ6CBICjs1 = function () {
59
+ return _reactnativereanimated.withTiming.call(void 0, isVisible ? 1 : 0, {
60
+ duration: DURATION
61
+ });
62
+ };
63
+ chunkF6CQ6CBICjs1.__closure = {
64
+ _reactnativereanimated,
65
+ isVisible,
66
+ DURATION
67
+ };
68
+ chunkF6CQ6CBICjs1.__workletHash = 11674708088880;
69
+ chunkF6CQ6CBICjs1.__pluginVersion = "0.7.4";
70
+ chunkF6CQ6CBICjs1.__initData = _worklet_11674708088880_init_data;
71
+ chunkF6CQ6CBICjs1.__stackDetails = _e;
72
+ return chunkF6CQ6CBICjs1;
73
+ }({
74
+ _worklet_11674708088880_init_data,
75
+ _reactnativereanimated,
76
+ isVisible,
77
+ DURATION
78
+ }), [isVisible]);
79
+ const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkF6CQ6CBICjs2Factory({
80
+ _worklet_9756080511809_init_data,
81
+ progress,
82
+ FROM_SCALE
83
+ }) {
84
+ const _e = [new global.Error(), -3, -27];
85
+ const chunkF6CQ6CBICjs2 = function () {
86
+ return {
87
+ opacity: progress.value,
88
+ transform: [{
89
+ scale: FROM_SCALE + (1 - FROM_SCALE) * progress.value
90
+ }]
91
+ };
92
+ };
93
+ chunkF6CQ6CBICjs2.__closure = {
94
+ progress,
95
+ FROM_SCALE
96
+ };
97
+ chunkF6CQ6CBICjs2.__workletHash = 9756080511809;
98
+ chunkF6CQ6CBICjs2.__pluginVersion = "0.7.4";
99
+ chunkF6CQ6CBICjs2.__initData = _worklet_9756080511809_init_data;
100
+ chunkF6CQ6CBICjs2.__stackDetails = _e;
101
+ return chunkF6CQ6CBICjs2;
102
+ }({
103
+ _worklet_9756080511809_init_data,
104
+ progress,
105
+ FROM_SCALE
106
+ }), [progress]);
107
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
108
+ style: [style, animatedStyle],
109
+ children
110
+ });
111
+ }
112
+ exports.SelectionFill = SelectionFill;
@@ -0,0 +1,42 @@
1
+ import {
2
+ warnDev
3
+ } from "./chunk-EGLLDKN6.js";
4
+
5
+ // src/hooks/use-controllable-state.ts
6
+ import { useCallback, useRef, useState } from "react";
7
+ function useControllableState({
8
+ value,
9
+ defaultValue,
10
+ onChange
11
+ }) {
12
+ const [uncontrolled, setUncontrolled] = useState(defaultValue);
13
+ const isControlled = value !== void 0;
14
+ const current = isControlled ? value : uncontrolled;
15
+ useControlWarning(isControlled);
16
+ const latest = useRef(current);
17
+ latest.current = current;
18
+ const onChangeRef = useRef(onChange);
19
+ onChangeRef.current = onChange;
20
+ const controlled = useRef(isControlled);
21
+ controlled.current = isControlled;
22
+ const set = useCallback((next) => {
23
+ const resolved = typeof next === "function" ? next(latest.current) : next;
24
+ if (resolved === latest.current) return;
25
+ if (!controlled.current) setUncontrolled(resolved);
26
+ onChangeRef.current?.(resolved);
27
+ }, []);
28
+ return [current, set];
29
+ }
30
+ function useControlWarning(isControlled) {
31
+ const wasControlled = useRef(isControlled);
32
+ if (wasControlled.current !== isControlled) {
33
+ warnDev(
34
+ `a component switched from ${wasControlled.current ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}. Decide for the life of the component: pass \`value\` always, or never. Passing \`undefined\` for a value you do control reads as "uncontrolled" here.`
35
+ );
36
+ wasControlled.current = isControlled;
37
+ }
38
+ }
39
+
40
+ export {
41
+ useControllableState
42
+ };
@@ -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
+ Icon
13
+ } from "./chunk-3FV4COTM.js";
14
+ import {
15
+ warnDev
16
+ } from "./chunk-EGLLDKN6.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
+ };