zkit-ui 1.0.0

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 (267) hide show
  1. package/README.md +267 -0
  2. package/dist/ComponentLibProvider.d.ts +15 -0
  3. package/dist/ComponentLibProvider.d.ts.map +1 -0
  4. package/dist/ComponentLibProvider.js +18 -0
  5. package/dist/assets/animations/spinner.json +1 -0
  6. package/dist/assets/icons/check.svg +4 -0
  7. package/dist/assets/icons/toast/error.webp +0 -0
  8. package/dist/assets/icons/toast/success.webp +0 -0
  9. package/dist/assets/icons/toast/warning.webp +0 -0
  10. package/dist/config.d.ts +16 -0
  11. package/dist/config.d.ts.map +1 -0
  12. package/dist/config.js +42 -0
  13. package/dist/i18n/I18nProvider.d.ts +11 -0
  14. package/dist/i18n/I18nProvider.d.ts.map +1 -0
  15. package/dist/i18n/I18nProvider.js +84 -0
  16. package/dist/i18n/locale.d.ts +7 -0
  17. package/dist/i18n/locale.d.ts.map +1 -0
  18. package/dist/i18n/locale.js +87 -0
  19. package/dist/i18n/locales/de.d.ts +51 -0
  20. package/dist/i18n/locales/de.d.ts.map +1 -0
  21. package/dist/i18n/locales/de.js +62 -0
  22. package/dist/i18n/locales/en-US.d.ts +51 -0
  23. package/dist/i18n/locales/en-US.d.ts.map +1 -0
  24. package/dist/i18n/locales/en-US.js +62 -0
  25. package/dist/i18n/locales/index.d.ts +9 -0
  26. package/dist/i18n/locales/index.d.ts.map +1 -0
  27. package/dist/i18n/locales/index.js +23 -0
  28. package/dist/i18n/locales/ja.d.ts +51 -0
  29. package/dist/i18n/locales/ja.d.ts.map +1 -0
  30. package/dist/i18n/locales/ja.js +62 -0
  31. package/dist/i18n/locales/zh-CN.d.ts +51 -0
  32. package/dist/i18n/locales/zh-CN.d.ts.map +1 -0
  33. package/dist/i18n/locales/zh-CN.js +62 -0
  34. package/dist/i18n/locales/zh-TW.d.ts +51 -0
  35. package/dist/i18n/locales/zh-TW.d.ts.map +1 -0
  36. package/dist/i18n/locales/zh-TW.js +62 -0
  37. package/dist/i18n/types.d.ts +11 -0
  38. package/dist/i18n/types.d.ts.map +1 -0
  39. package/dist/i18n/types.js +2 -0
  40. package/dist/i18n/useI18n.d.ts +2 -0
  41. package/dist/i18n/useI18n.d.ts.map +1 -0
  42. package/dist/i18n/useI18n.js +41 -0
  43. package/dist/index.d.ts +57 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +90 -0
  46. package/dist/services/ActionDialogService/ActionDialog.d.ts +4 -0
  47. package/dist/services/ActionDialogService/ActionDialog.d.ts.map +1 -0
  48. package/dist/services/ActionDialogService/ActionDialog.js +531 -0
  49. package/dist/services/ActionDialogService/index.d.ts +4 -0
  50. package/dist/services/ActionDialogService/index.d.ts.map +1 -0
  51. package/dist/services/ActionDialogService/index.js +8 -0
  52. package/dist/services/ActionDialogService/service.d.ts +7 -0
  53. package/dist/services/ActionDialogService/service.d.ts.map +1 -0
  54. package/dist/services/ActionDialogService/service.js +309 -0
  55. package/dist/services/ActionDialogService/shared.d.ts +17 -0
  56. package/dist/services/ActionDialogService/shared.d.ts.map +1 -0
  57. package/dist/services/ActionDialogService/shared.js +167 -0
  58. package/dist/services/ActionDialogService/types.d.ts +160 -0
  59. package/dist/services/ActionDialogService/types.d.ts.map +1 -0
  60. package/dist/services/ActionDialogService/types.js +2 -0
  61. package/dist/services/CardToastService/index.d.ts +115 -0
  62. package/dist/services/CardToastService/index.d.ts.map +1 -0
  63. package/dist/services/CardToastService/index.js +899 -0
  64. package/dist/services/ImagePreviewService/index.d.ts +179 -0
  65. package/dist/services/ImagePreviewService/index.d.ts.map +1 -0
  66. package/dist/services/ImagePreviewService/index.js +1383 -0
  67. package/dist/services/LoadingService/index.d.ts +146 -0
  68. package/dist/services/LoadingService/index.d.ts.map +1 -0
  69. package/dist/services/LoadingService/index.js +827 -0
  70. package/dist/services/PermissionPurposeDialogService/index.d.ts +99 -0
  71. package/dist/services/PermissionPurposeDialogService/index.d.ts.map +1 -0
  72. package/dist/services/PermissionPurposeDialogService/index.js +360 -0
  73. package/dist/services/PickerService/index.d.ts +128 -0
  74. package/dist/services/PickerService/index.d.ts.map +1 -0
  75. package/dist/services/PickerService/index.js +250 -0
  76. package/dist/theme/ThemeProvider.d.ts +15 -0
  77. package/dist/theme/ThemeProvider.d.ts.map +1 -0
  78. package/dist/theme/ThemeProvider.js +61 -0
  79. package/dist/theme/defaultTheme.d.ts +3 -0
  80. package/dist/theme/defaultTheme.d.ts.map +1 -0
  81. package/dist/theme/defaultTheme.js +28 -0
  82. package/dist/theme/mergeTheme.d.ts +3 -0
  83. package/dist/theme/mergeTheme.d.ts.map +1 -0
  84. package/dist/theme/mergeTheme.js +19 -0
  85. package/dist/theme/types.d.ts +17 -0
  86. package/dist/theme/types.d.ts.map +1 -0
  87. package/dist/theme/types.js +2 -0
  88. package/dist/theme/useTheme.d.ts +2 -0
  89. package/dist/theme/useTheme.d.ts.map +1 -0
  90. package/dist/theme/useTheme.js +46 -0
  91. package/dist/ui/Accordion/index.d.ts +99 -0
  92. package/dist/ui/Accordion/index.d.ts.map +1 -0
  93. package/dist/ui/Accordion/index.js +777 -0
  94. package/dist/ui/AddressCascader/index.d.ts +58 -0
  95. package/dist/ui/AddressCascader/index.d.ts.map +1 -0
  96. package/dist/ui/AddressCascader/index.js +710 -0
  97. package/dist/ui/BetweenTime/index.d.ts +82 -0
  98. package/dist/ui/BetweenTime/index.d.ts.map +1 -0
  99. package/dist/ui/BetweenTime/index.js +702 -0
  100. package/dist/ui/Button/index.d.ts +93 -0
  101. package/dist/ui/Button/index.d.ts.map +1 -0
  102. package/dist/ui/Button/index.js +832 -0
  103. package/dist/ui/Checkbox/index.d.ts +103 -0
  104. package/dist/ui/Checkbox/index.d.ts.map +1 -0
  105. package/dist/ui/Checkbox/index.js +694 -0
  106. package/dist/ui/DatePicker/index.d.ts +5 -0
  107. package/dist/ui/DatePicker/index.d.ts.map +1 -0
  108. package/dist/ui/DatePicker/index.js +157 -0
  109. package/dist/ui/DatePicker/types.d.ts +99 -0
  110. package/dist/ui/DatePicker/types.d.ts.map +1 -0
  111. package/dist/ui/DatePicker/types.js +2 -0
  112. package/dist/ui/DatePicker/utils.d.ts +32 -0
  113. package/dist/ui/DatePicker/utils.d.ts.map +1 -0
  114. package/dist/ui/DatePicker/utils.js +316 -0
  115. package/dist/ui/LinkedScroll/index.d.ts +78 -0
  116. package/dist/ui/LinkedScroll/index.d.ts.map +1 -0
  117. package/dist/ui/LinkedScroll/index.js +470 -0
  118. package/dist/ui/LoadingSpinner/index.d.ts +8 -0
  119. package/dist/ui/LoadingSpinner/index.d.ts.map +1 -0
  120. package/dist/ui/LoadingSpinner/index.js +122 -0
  121. package/dist/ui/Picker/actionBar.d.ts +14 -0
  122. package/dist/ui/Picker/actionBar.d.ts.map +1 -0
  123. package/dist/ui/Picker/actionBar.js +28 -0
  124. package/dist/ui/Picker/index.d.ts +5 -0
  125. package/dist/ui/Picker/index.d.ts.map +1 -0
  126. package/dist/ui/Picker/index.js +412 -0
  127. package/dist/ui/Picker/types.d.ts +80 -0
  128. package/dist/ui/Picker/types.d.ts.map +1 -0
  129. package/dist/ui/Picker/types.js +2 -0
  130. package/dist/ui/Picker/utils.d.ts +27 -0
  131. package/dist/ui/Picker/utils.d.ts.map +1 -0
  132. package/dist/ui/Picker/utils.js +182 -0
  133. package/dist/ui/Radio/index.d.ts +95 -0
  134. package/dist/ui/Radio/index.d.ts.map +1 -0
  135. package/dist/ui/Radio/index.js +633 -0
  136. package/dist/ui/Sheet/index.d.ts +12 -0
  137. package/dist/ui/Sheet/index.d.ts.map +1 -0
  138. package/dist/ui/Sheet/index.js +832 -0
  139. package/dist/ui/Sheet/nativeBottom.d.ts +52 -0
  140. package/dist/ui/Sheet/nativeBottom.d.ts.map +1 -0
  141. package/dist/ui/Sheet/nativeBottom.js +442 -0
  142. package/dist/ui/Sheet/nativeBottom.web.d.ts +18 -0
  143. package/dist/ui/Sheet/nativeBottom.web.d.ts.map +1 -0
  144. package/dist/ui/Sheet/nativeBottom.web.js +46 -0
  145. package/dist/ui/Sheet/slots.d.ts +5 -0
  146. package/dist/ui/Sheet/slots.d.ts.map +1 -0
  147. package/dist/ui/Sheet/slots.js +40 -0
  148. package/dist/ui/Sheet/types.d.ts +131 -0
  149. package/dist/ui/Sheet/types.d.ts.map +1 -0
  150. package/dist/ui/Sheet/types.js +2 -0
  151. package/dist/ui/SliderCaptcha/index.d.ts +57 -0
  152. package/dist/ui/SliderCaptcha/index.d.ts.map +1 -0
  153. package/dist/ui/SliderCaptcha/index.js +586 -0
  154. package/dist/ui/Switch/index.d.ts +72 -0
  155. package/dist/ui/Switch/index.d.ts.map +1 -0
  156. package/dist/ui/Switch/index.js +671 -0
  157. package/dist/ui/Text/index.d.ts +41 -0
  158. package/dist/ui/Text/index.d.ts.map +1 -0
  159. package/dist/ui/Text/index.js +325 -0
  160. package/dist/ui/TextInput/TextInputPrimitive.d.ts +8 -0
  161. package/dist/ui/TextInput/TextInputPrimitive.d.ts.map +1 -0
  162. package/dist/ui/TextInput/TextInputPrimitive.js +54 -0
  163. package/dist/ui/TextInput/index.d.ts +89 -0
  164. package/dist/ui/TextInput/index.d.ts.map +1 -0
  165. package/dist/ui/TextInput/index.js +545 -0
  166. package/dist/ui/WheelColumn/ZKitWheelPickerNativeComponent.d.ts +39 -0
  167. package/dist/ui/WheelColumn/ZKitWheelPickerNativeComponent.d.ts.map +1 -0
  168. package/dist/ui/WheelColumn/ZKitWheelPickerNativeComponent.js +60 -0
  169. package/dist/ui/WheelColumn/constants.d.ts +2 -0
  170. package/dist/ui/WheelColumn/constants.d.ts.map +1 -0
  171. package/dist/ui/WheelColumn/constants.js +4 -0
  172. package/dist/ui/WheelColumn/index.d.ts +59 -0
  173. package/dist/ui/WheelColumn/index.d.ts.map +1 -0
  174. package/dist/ui/WheelColumn/index.js +547 -0
  175. package/ios/ZKitWheelPicker.h +18 -0
  176. package/ios/ZKitWheelPicker.mm +230 -0
  177. package/ios/ZKitWheelPickerLabel.h +10 -0
  178. package/ios/ZKitWheelPickerLabel.mm +31 -0
  179. package/ios/ZKitWheelPickerManager.h +5 -0
  180. package/ios/ZKitWheelPickerManager.mm +53 -0
  181. package/package.json +75 -0
  182. package/react-native.config.js +10 -0
  183. package/src/ComponentLibProvider.tsx +56 -0
  184. package/src/assets/animations/spinner.json +1 -0
  185. package/src/assets/icons/check.svg +4 -0
  186. package/src/assets/icons/toast/error.webp +0 -0
  187. package/src/assets/icons/toast/success.webp +0 -0
  188. package/src/assets/icons/toast/warning.webp +0 -0
  189. package/src/config.ts +65 -0
  190. package/src/i18n/I18nProvider.tsx +69 -0
  191. package/src/i18n/locale.ts +108 -0
  192. package/src/i18n/locales/de.ts +67 -0
  193. package/src/i18n/locales/en-US.ts +67 -0
  194. package/src/i18n/locales/index.ts +19 -0
  195. package/src/i18n/locales/ja.ts +67 -0
  196. package/src/i18n/locales/zh-CN.ts +67 -0
  197. package/src/i18n/locales/zh-TW.ts +67 -0
  198. package/src/i18n/types.ts +21 -0
  199. package/src/i18n/useI18n.ts +7 -0
  200. package/src/index.ts +395 -0
  201. package/src/services/ActionDialogService/ActionDialog.tsx +756 -0
  202. package/src/services/ActionDialogService/README.md +146 -0
  203. package/src/services/ActionDialogService/index.tsx +39 -0
  204. package/src/services/ActionDialogService/service.tsx +355 -0
  205. package/src/services/ActionDialogService/shared.ts +204 -0
  206. package/src/services/ActionDialogService/types.ts +197 -0
  207. package/src/services/CardToastService/README.md +128 -0
  208. package/src/services/CardToastService/index.tsx +1284 -0
  209. package/src/services/ImagePreviewService/README.md +67 -0
  210. package/src/services/ImagePreviewService/index.tsx +2148 -0
  211. package/src/services/LoadingService/README.md +128 -0
  212. package/src/services/LoadingService/index.tsx +1113 -0
  213. package/src/services/PermissionPurposeDialogService/README.md +80 -0
  214. package/src/services/PermissionPurposeDialogService/index.tsx +449 -0
  215. package/src/services/PickerService/README.md +154 -0
  216. package/src/services/PickerService/index.tsx +410 -0
  217. package/src/theme/ThemeProvider.tsx +40 -0
  218. package/src/theme/defaultTheme.ts +30 -0
  219. package/src/theme/mergeTheme.ts +16 -0
  220. package/src/theme/types.ts +36 -0
  221. package/src/theme/useTheme.ts +10 -0
  222. package/src/types/svg.d.ts +9 -0
  223. package/src/types/vant-area-data.d.ts +19 -0
  224. package/src/ui/Accordion/README.md +67 -0
  225. package/src/ui/Accordion/index.tsx +1221 -0
  226. package/src/ui/AddressCascader/README.md +144 -0
  227. package/src/ui/AddressCascader/index.tsx +1084 -0
  228. package/src/ui/BetweenTime/README.md +490 -0
  229. package/src/ui/BetweenTime/index.tsx +1001 -0
  230. package/src/ui/Button/README.md +186 -0
  231. package/src/ui/Button/index.tsx +1356 -0
  232. package/src/ui/Checkbox/README.md +211 -0
  233. package/src/ui/Checkbox/index.tsx +1231 -0
  234. package/src/ui/DatePicker/README.md +117 -0
  235. package/src/ui/DatePicker/index.tsx +295 -0
  236. package/src/ui/DatePicker/types.ts +115 -0
  237. package/src/ui/DatePicker/utils.ts +405 -0
  238. package/src/ui/LinkedScroll/README.md +55 -0
  239. package/src/ui/LinkedScroll/index.tsx +809 -0
  240. package/src/ui/LoadingSpinner/index.tsx +104 -0
  241. package/src/ui/Picker/README.md +190 -0
  242. package/src/ui/Picker/actionBar.tsx +70 -0
  243. package/src/ui/Picker/index.tsx +694 -0
  244. package/src/ui/Picker/types.ts +94 -0
  245. package/src/ui/Picker/utils.ts +239 -0
  246. package/src/ui/Radio/README.md +207 -0
  247. package/src/ui/Radio/index.tsx +1117 -0
  248. package/src/ui/Sheet/README.md +82 -0
  249. package/src/ui/Sheet/index.tsx +1163 -0
  250. package/src/ui/Sheet/nativeBottom.tsx +683 -0
  251. package/src/ui/Sheet/nativeBottom.web.tsx +40 -0
  252. package/src/ui/Sheet/slots.tsx +75 -0
  253. package/src/ui/Sheet/types.ts +195 -0
  254. package/src/ui/SliderCaptcha/README.md +61 -0
  255. package/src/ui/SliderCaptcha/index.tsx +816 -0
  256. package/src/ui/Switch/README.md +143 -0
  257. package/src/ui/Switch/index.tsx +1092 -0
  258. package/src/ui/Text/README.md +157 -0
  259. package/src/ui/Text/index.tsx +450 -0
  260. package/src/ui/TextInput/README.md +197 -0
  261. package/src/ui/TextInput/TextInputPrimitive.tsx +44 -0
  262. package/src/ui/TextInput/index.tsx +942 -0
  263. package/src/ui/WheelColumn/README.md +104 -0
  264. package/src/ui/WheelColumn/ZKitWheelPickerNativeComponent.tsx +68 -0
  265. package/src/ui/WheelColumn/constants.ts +1 -0
  266. package/src/ui/WheelColumn/index.tsx +826 -0
  267. package/zkit-ui.podspec +19 -0
@@ -0,0 +1,633 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Radio = void 0;
37
+ exports.RadioIndicator = RadioIndicator;
38
+ exports.RadioGroup = RadioGroup;
39
+ const jsx_runtime_1 = require("react/jsx-runtime");
40
+ const React = __importStar(require("react"));
41
+ const react_native_1 = require("react-native");
42
+ const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
43
+ const zkit_tools_1 = require("zkit-tools");
44
+ const useTheme_1 = require("../../theme/useTheme");
45
+ const Text_1 = require("../Text");
46
+ const RadioIndicatorContext = React.createContext(null);
47
+ const noopSubscribe = () => () => { };
48
+ class RadioGroupStore {
49
+ constructor(initialValue) {
50
+ this.listeners = new Set();
51
+ this.subscribe = (listener) => {
52
+ this.listeners.add(listener);
53
+ return () => {
54
+ this.listeners.delete(listener);
55
+ };
56
+ };
57
+ this.isSelected = (value) => Object.is(this.value, value);
58
+ this.setValue = (value) => {
59
+ if (Object.is(this.value, value))
60
+ return false;
61
+ this.value = value;
62
+ this.emit();
63
+ return true;
64
+ };
65
+ this.value = initialValue;
66
+ }
67
+ emit() {
68
+ for (const listener of this.listeners)
69
+ listener();
70
+ }
71
+ }
72
+ const RadioGroupContext = React.createContext(null);
73
+ const SEMANTIC_COLORS = {
74
+ danger: '#DC2626',
75
+ error: '#DC2626',
76
+ info: '#2563EB',
77
+ success: '#16A34A',
78
+ warn: '#D97706',
79
+ warning: '#D97706',
80
+ };
81
+ const SIZE_TOKENS = {
82
+ sm: {
83
+ indicatorSize: 18,
84
+ indicatorDotSize: 8,
85
+ indicatorBorderWidth: 1.5,
86
+ gap: 8,
87
+ },
88
+ md: {
89
+ indicatorSize: 20,
90
+ indicatorDotSize: 9,
91
+ indicatorBorderWidth: 1.5,
92
+ gap: 10,
93
+ },
94
+ lg: {
95
+ indicatorSize: 24,
96
+ indicatorDotSize: 11,
97
+ indicatorBorderWidth: 1.5,
98
+ gap: 12,
99
+ },
100
+ };
101
+ const DISABLED_OPACITY = 0.48;
102
+ const PRESSED_OPACITY = 0.86;
103
+ const PRESSED_SCALE = 0.965;
104
+ const VALUE_TIMING_DURATION = 170;
105
+ const PRESS_IN_DURATION = 90;
106
+ const PRESS_OUT_DURATION = 140;
107
+ const FOCUS_DURATION = 120;
108
+ function useRadioIndicatorContext() {
109
+ const context = React.useContext(RadioIndicatorContext);
110
+ if (!context) {
111
+ throw new Error('[zkit-ui] RadioIndicator must be rendered inside <Radio />.');
112
+ }
113
+ return context;
114
+ }
115
+ function isProcessableColor(color) {
116
+ return (0, react_native_1.processColor)(color) != null;
117
+ }
118
+ function colorToRgba(color, alpha) {
119
+ const processed = (0, react_native_1.processColor)(color);
120
+ if (typeof processed !== 'number')
121
+ return undefined;
122
+ const normalized = processed >>> 0;
123
+ const r = (normalized >> 16) & 255;
124
+ const g = (normalized >> 8) & 255;
125
+ const b = normalized & 255;
126
+ const a = Math.max(0, Math.min(1, alpha));
127
+ return `rgba(${r},${g},${b},${a})`;
128
+ }
129
+ function resolveColorToken(input, fallback, theme) {
130
+ var _a;
131
+ if (input == null)
132
+ return fallback;
133
+ const key = input.trim();
134
+ if (!key)
135
+ return fallback;
136
+ const resolved = key === 'default' || key === 'neutral' || key === 'onSurface'
137
+ ? theme.colors.onSurface
138
+ : key === 'primary'
139
+ ? theme.colors.primary
140
+ : key === 'onPrimary' || key === 'inverse'
141
+ ? theme.colors.onPrimary
142
+ : key === 'secondary'
143
+ ? theme.colors.secondary
144
+ : key === 'onSecondary'
145
+ ? theme.colors.onSecondary
146
+ : key === 'surface'
147
+ ? theme.colors.surface
148
+ : key === 'border'
149
+ ? theme.colors.border
150
+ : key === 'muted'
151
+ ? theme.colors.muted
152
+ : key === 'disabled' || key === 'subtle'
153
+ ? theme.colors.disabled
154
+ : (_a = SEMANTIC_COLORS[key]) !== null && _a !== void 0 ? _a : key;
155
+ return isProcessableColor(resolved) ? resolved : fallback;
156
+ }
157
+ function resolveTonePalette(tone, theme) {
158
+ if (tone === 'neutral') {
159
+ return {
160
+ accent: theme.colors.onSurface,
161
+ onAccent: theme.colors.surface,
162
+ };
163
+ }
164
+ if (tone === 'success') {
165
+ return {
166
+ accent: SEMANTIC_COLORS.success,
167
+ onAccent: '#FFFFFF',
168
+ };
169
+ }
170
+ if (tone === 'warning') {
171
+ return {
172
+ accent: SEMANTIC_COLORS.warning,
173
+ onAccent: '#FFFFFF',
174
+ };
175
+ }
176
+ if (tone === 'danger') {
177
+ return {
178
+ accent: SEMANTIC_COLORS.danger,
179
+ onAccent: '#FFFFFF',
180
+ };
181
+ }
182
+ if (tone === 'info') {
183
+ return {
184
+ accent: SEMANTIC_COLORS.info,
185
+ onAccent: '#FFFFFF',
186
+ };
187
+ }
188
+ return {
189
+ accent: theme.colors.primary,
190
+ onAccent: theme.colors.onPrimary,
191
+ };
192
+ }
193
+ function resolveVariantColors(variant, accent, onAccent, colors, theme, scheme) {
194
+ var _a, _b, _c;
195
+ const softAlpha = scheme === 'dark' ? 0.24 : 0.14;
196
+ const fallbackSoftBackground = (_a = colorToRgba(accent, softAlpha)) !== null && _a !== void 0 ? _a : theme.colors.secondary;
197
+ const fallbackUncheckedBorder = (_b = colorToRgba(theme.colors.onSurface, scheme === 'dark' ? 0.28 : 0.18)) !== null && _b !== void 0 ? _b : theme.colors.border;
198
+ const checkedBackground = variant === 'solid'
199
+ ? accent
200
+ : variant === 'soft'
201
+ ? fallbackSoftBackground
202
+ : theme.colors.surface;
203
+ const checkedIndicator = variant === 'solid' ? onAccent : accent;
204
+ return {
205
+ checkedBackground: resolveColorToken(colors === null || colors === void 0 ? void 0 : colors.checkedBackground, checkedBackground, theme),
206
+ checkedBorder: resolveColorToken(colors === null || colors === void 0 ? void 0 : colors.checkedBorder, accent, theme),
207
+ checkedIndicator: resolveColorToken(colors === null || colors === void 0 ? void 0 : colors.checkedIndicator, checkedIndicator, theme),
208
+ uncheckedBackground: resolveColorToken(colors === null || colors === void 0 ? void 0 : colors.uncheckedBackground, theme.colors.surface, theme),
209
+ uncheckedBorder: resolveColorToken(colors === null || colors === void 0 ? void 0 : colors.uncheckedBorder, fallbackUncheckedBorder, theme),
210
+ focusRing: resolveColorToken(colors === null || colors === void 0 ? void 0 : colors.focusRing, (_c = colorToRgba(accent, scheme === 'dark' ? 0.36 : 0.28)) !== null && _c !== void 0 ? _c : accent, theme),
211
+ };
212
+ }
213
+ function resolveRadioMetrics(size, layout) {
214
+ var _a;
215
+ const token = (_a = SIZE_TOKENS[size]) !== null && _a !== void 0 ? _a : SIZE_TOKENS.md;
216
+ const indicatorSize = resolvePositiveNumber(layout === null || layout === void 0 ? void 0 : layout.indicatorSize, (0, zkit_tools_1.wp)(token.indicatorSize));
217
+ return {
218
+ indicatorSize,
219
+ indicatorDotSize: resolvePositiveNumber(layout === null || layout === void 0 ? void 0 : layout.indicatorDotSize, (0, zkit_tools_1.wp)(token.indicatorDotSize)),
220
+ indicatorBorderWidth: resolvePositiveNumber(layout === null || layout === void 0 ? void 0 : layout.indicatorBorderWidth, (0, zkit_tools_1.wp)(token.indicatorBorderWidth)),
221
+ gap: resolveNonNegativeNumber(layout === null || layout === void 0 ? void 0 : layout.gap, (0, zkit_tools_1.wp)(token.gap)),
222
+ minTouchTarget: resolvePositiveNumber(layout === null || layout === void 0 ? void 0 : layout.minTouchTarget, (0, zkit_tools_1.wp)(44)),
223
+ focusRingWidth: resolvePositiveNumber(layout === null || layout === void 0 ? void 0 : layout.focusRingWidth, (0, zkit_tools_1.wp)(2)),
224
+ focusRingOffset: resolveNonNegativeNumber(layout === null || layout === void 0 ? void 0 : layout.focusRingOffset, (0, zkit_tools_1.wp)(3)),
225
+ };
226
+ }
227
+ function resolvePositiveNumber(value, fallback) {
228
+ return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : fallback;
229
+ }
230
+ function resolveNonNegativeNumber(value, fallback) {
231
+ return typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : fallback;
232
+ }
233
+ function resolveDuration(duration) {
234
+ if (duration == null || !Number.isFinite(duration))
235
+ return VALUE_TIMING_DURATION;
236
+ return Math.max(0, duration);
237
+ }
238
+ function toTimingConfig(duration) {
239
+ return {
240
+ duration,
241
+ easing: react_native_reanimated_1.Easing.out(react_native_reanimated_1.Easing.cubic),
242
+ reduceMotion: react_native_reanimated_1.ReduceMotion.System,
243
+ };
244
+ }
245
+ function resolveHitSlop(width, height, minTouchTarget) {
246
+ const vertical = Math.max(0, (minTouchTarget - height) / 2);
247
+ const horizontal = Math.max(0, (minTouchTarget - width) / 2);
248
+ if (vertical === 0 && horizontal === 0)
249
+ return undefined;
250
+ return {
251
+ top: vertical,
252
+ bottom: vertical,
253
+ left: horizontal,
254
+ right: horizontal,
255
+ };
256
+ }
257
+ function resolveWebCursorStyle(disabled) {
258
+ if (react_native_1.Platform.OS !== 'web')
259
+ return undefined;
260
+ return { cursor: disabled ? 'not-allowed' : 'pointer' };
261
+ }
262
+ function isPrimitiveText(node) {
263
+ return typeof node === 'string' || typeof node === 'number';
264
+ }
265
+ function isRenderProp(children) {
266
+ return typeof children === 'function';
267
+ }
268
+ function isIndicatorRenderProp(indicator) {
269
+ return typeof indicator === 'function';
270
+ }
271
+ function resolveAlignItems(align) {
272
+ if (align === 'center')
273
+ return 'center';
274
+ if (align === 'end')
275
+ return 'flex-end';
276
+ if (align === 'stretch')
277
+ return 'stretch';
278
+ return 'flex-start';
279
+ }
280
+ function RadioImpl({ value, checked: checkedProp, defaultChecked = false, onChange, allowDeselect, disabled = false, size: sizeProp, tone: toneProp, variant: variantProp, duration, color: colorProp, colors: colorsProp, layout: layoutProp, label, description, labelPlacement = 'end', children, showIndicator = true, indicator, style, contentStyle, indicatorStyle, labelStyle, descriptionStyle, accessibilityLabel, accessibilityState, hitSlop, onPress, onPressIn, onPressOut, onFocus, onBlur, testID, ...pressableProps }, ref) {
281
+ var _a, _b, _c, _d, _e;
282
+ const theme = (0, useTheme_1.useTheme)();
283
+ const scheme = (0, react_native_1.useColorScheme)();
284
+ const { width: viewportWidth } = (0, react_native_1.useWindowDimensions)();
285
+ const group = React.useContext(RadioGroupContext);
286
+ const isRTL = react_native_1.I18nManager.isRTL;
287
+ const isStandaloneControlled = checkedProp !== undefined;
288
+ const isGroupItem = group != null && value !== undefined && !isStandaloneControlled;
289
+ const [uncontrolledChecked, setUncontrolledChecked] = React.useState(() => defaultChecked);
290
+ const getGroupCheckedSnapshot = React.useCallback(() => (group && value !== undefined ? group.store.isSelected(value) : false), [group, value]);
291
+ const groupChecked = React.useSyncExternalStore((_a = group === null || group === void 0 ? void 0 : group.store.subscribe) !== null && _a !== void 0 ? _a : noopSubscribe, getGroupCheckedSnapshot, getGroupCheckedSnapshot);
292
+ const checked = isGroupItem
293
+ ? groupChecked
294
+ : isStandaloneControlled
295
+ ? checkedProp
296
+ : uncontrolledChecked;
297
+ const resolvedDisabled = disabled || Boolean(group === null || group === void 0 ? void 0 : group.disabled);
298
+ const interactive = !resolvedDisabled;
299
+ const resolvedAllowDeselect = (_b = allowDeselect !== null && allowDeselect !== void 0 ? allowDeselect : group === null || group === void 0 ? void 0 : group.allowDeselect) !== null && _b !== void 0 ? _b : false;
300
+ const size = (_c = sizeProp !== null && sizeProp !== void 0 ? sizeProp : group === null || group === void 0 ? void 0 : group.size) !== null && _c !== void 0 ? _c : 'md';
301
+ const tone = (_d = toneProp !== null && toneProp !== void 0 ? toneProp : group === null || group === void 0 ? void 0 : group.tone) !== null && _d !== void 0 ? _d : 'primary';
302
+ const variant = (_e = variantProp !== null && variantProp !== void 0 ? variantProp : group === null || group === void 0 ? void 0 : group.variant) !== null && _e !== void 0 ? _e : 'outline';
303
+ const color = colorProp !== null && colorProp !== void 0 ? colorProp : group === null || group === void 0 ? void 0 : group.color;
304
+ const colors = React.useMemo(() => (group === null || group === void 0 ? void 0 : group.colors) || colorsProp
305
+ ? {
306
+ ...group === null || group === void 0 ? void 0 : group.colors,
307
+ ...colorsProp,
308
+ }
309
+ : undefined, [colorsProp, group === null || group === void 0 ? void 0 : group.colors]);
310
+ const layout = React.useMemo(() => (group === null || group === void 0 ? void 0 : group.layout) || layoutProp
311
+ ? {
312
+ ...group === null || group === void 0 ? void 0 : group.layout,
313
+ ...layoutProp,
314
+ }
315
+ : undefined, [group === null || group === void 0 ? void 0 : group.layout, layoutProp]);
316
+ const metrics = React.useMemo(() => resolveRadioMetrics(size, layout), [layout, size, viewportWidth]);
317
+ const tonePalette = React.useMemo(() => resolveTonePalette(tone, theme), [theme, tone]);
318
+ const accent = React.useMemo(() => resolveColorToken(color, tonePalette.accent, theme), [color, theme, tonePalette.accent]);
319
+ const resolvedColors = React.useMemo(() => resolveVariantColors(variant, accent, tonePalette.onAccent, colors, theme, scheme), [accent, colors, scheme, theme, tonePalette.onAccent, variant]);
320
+ const webCursorStyle = React.useMemo(() => resolveWebCursorStyle(resolvedDisabled), [resolvedDisabled]);
321
+ const defaultHitSlop = React.useMemo(() => resolveHitSlop(metrics.indicatorSize, metrics.indicatorSize, metrics.minTouchTarget), [metrics.indicatorSize, metrics.minTouchTarget]);
322
+ const resolvedDuration = resolveDuration(duration);
323
+ const valueTiming = React.useMemo(() => toTimingConfig(resolvedDuration), [resolvedDuration]);
324
+ const pressInTiming = React.useMemo(() => toTimingConfig(PRESS_IN_DURATION), []);
325
+ const pressOutTiming = React.useMemo(() => toTimingConfig(PRESS_OUT_DURATION), []);
326
+ const focusTiming = React.useMemo(() => toTimingConfig(FOCUS_DURATION), []);
327
+ const checkedSv = (0, react_native_reanimated_1.useSharedValue)(checked ? 1 : 0);
328
+ const pressSv = (0, react_native_reanimated_1.useSharedValue)(0);
329
+ const focusSv = (0, react_native_reanimated_1.useSharedValue)(0);
330
+ const checkedRef = React.useRef(checked);
331
+ checkedRef.current = checked;
332
+ const groupCheckedRef = React.useRef(groupChecked);
333
+ groupCheckedRef.current = groupChecked;
334
+ React.useEffect(() => {
335
+ if (!isStandaloneControlled && !isGroupItem)
336
+ return;
337
+ checkedSv.value = (0, react_native_reanimated_1.withTiming)(checked ? 1 : 0, valueTiming);
338
+ }, [checked, checkedSv, isGroupItem, isStandaloneControlled, valueTiming]);
339
+ React.useEffect(() => {
340
+ if (interactive)
341
+ return;
342
+ pressSv.value = (0, react_native_reanimated_1.withTiming)(0, pressOutTiming);
343
+ focusSv.value = (0, react_native_reanimated_1.withTiming)(0, focusTiming);
344
+ }, [focusSv, focusTiming, interactive, pressOutTiming, pressSv]);
345
+ const commitStandaloneChecked = React.useCallback((next) => {
346
+ if (!isStandaloneControlled) {
347
+ checkedRef.current = next;
348
+ checkedSv.value = (0, react_native_reanimated_1.withTiming)(next ? 1 : 0, valueTiming);
349
+ setUncontrolledChecked(next);
350
+ }
351
+ onChange === null || onChange === void 0 ? void 0 : onChange(next);
352
+ }, [checkedSv, isStandaloneControlled, onChange, valueTiming]);
353
+ const select = React.useCallback(() => {
354
+ if (!interactive)
355
+ return;
356
+ if (isGroupItem && group && value !== undefined) {
357
+ const isSelected = groupCheckedRef.current;
358
+ if (isSelected && !resolvedAllowDeselect)
359
+ return;
360
+ const nextValue = isSelected ? null : value;
361
+ if (!group.isControlled) {
362
+ checkedSv.value = (0, react_native_reanimated_1.withTiming)(isSelected ? 0 : 1, valueTiming);
363
+ }
364
+ group.selectValue(nextValue);
365
+ onChange === null || onChange === void 0 ? void 0 : onChange(!isSelected);
366
+ return;
367
+ }
368
+ const current = checkedRef.current;
369
+ if (current && !resolvedAllowDeselect)
370
+ return;
371
+ commitStandaloneChecked(current ? false : true);
372
+ }, [
373
+ checkedSv,
374
+ commitStandaloneChecked,
375
+ group,
376
+ interactive,
377
+ isGroupItem,
378
+ onChange,
379
+ resolvedAllowDeselect,
380
+ value,
381
+ valueTiming,
382
+ ]);
383
+ const handlePress = React.useCallback((event) => {
384
+ if (interactive)
385
+ select();
386
+ onPress === null || onPress === void 0 ? void 0 : onPress(event);
387
+ }, [interactive, onPress, select]);
388
+ const handlePressIn = React.useCallback((event) => {
389
+ if (interactive) {
390
+ pressSv.value = (0, react_native_reanimated_1.withTiming)(1, pressInTiming);
391
+ }
392
+ onPressIn === null || onPressIn === void 0 ? void 0 : onPressIn(event);
393
+ }, [interactive, onPressIn, pressInTiming, pressSv]);
394
+ const handlePressOut = React.useCallback((event) => {
395
+ pressSv.value = (0, react_native_reanimated_1.withTiming)(0, pressOutTiming);
396
+ onPressOut === null || onPressOut === void 0 ? void 0 : onPressOut(event);
397
+ }, [onPressOut, pressOutTiming, pressSv]);
398
+ const handleFocus = React.useCallback((event) => {
399
+ if (interactive) {
400
+ focusSv.value = (0, react_native_reanimated_1.withTiming)(1, focusTiming);
401
+ }
402
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
403
+ }, [focusSv, focusTiming, interactive, onFocus]);
404
+ const handleBlur = React.useCallback((event) => {
405
+ focusSv.value = (0, react_native_reanimated_1.withTiming)(0, focusTiming);
406
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
407
+ }, [focusSv, focusTiming, onBlur]);
408
+ const slot = React.useMemo(() => ({
409
+ checked,
410
+ value,
411
+ disabled: resolvedDisabled,
412
+ interactive,
413
+ size,
414
+ tone,
415
+ variant,
416
+ select,
417
+ }), [checked, interactive, resolvedDisabled, select, size, tone, value, variant]);
418
+ const renderedContent = React.useMemo(() => {
419
+ if (isRenderProp(children))
420
+ return children(slot);
421
+ if (children != null)
422
+ return children;
423
+ if (label == null && description == null)
424
+ return null;
425
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.copy, children: [label != null ? (isPrimitiveText(label) ? ((0, jsx_runtime_1.jsx)(Text_1.Text, { disabled: resolvedDisabled, numberOfLines: 1, variant: "label", style: labelStyle, children: label })) : (label)) : null, description != null ? (isPrimitiveText(description) ? ((0, jsx_runtime_1.jsx)(Text_1.Text, { disabled: resolvedDisabled, numberOfLines: 2, tone: resolvedDisabled ? 'disabled' : 'muted', variant: "caption", style: descriptionStyle, children: description })) : (description)) : null] }));
426
+ }, [
427
+ children,
428
+ description,
429
+ descriptionStyle,
430
+ label,
431
+ labelStyle,
432
+ resolvedDisabled,
433
+ slot,
434
+ ]);
435
+ const indicatorContext = React.useMemo(() => ({
436
+ checkedSv,
437
+ indicatorSize: metrics.indicatorSize,
438
+ indicatorDotSize: metrics.indicatorDotSize,
439
+ slot,
440
+ checkedIndicatorColor: resolvedColors.checkedIndicator,
441
+ customIndicator: indicator,
442
+ }), [
443
+ checkedSv,
444
+ indicator,
445
+ metrics.indicatorDotSize,
446
+ metrics.indicatorSize,
447
+ resolvedColors.checkedIndicator,
448
+ slot,
449
+ ]);
450
+ const visualAnimatedStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
451
+ const opacity = resolvedDisabled
452
+ ? DISABLED_OPACITY
453
+ : (0, react_native_reanimated_1.interpolate)(pressSv.value, [0, 1], [1, PRESSED_OPACITY]);
454
+ return { opacity };
455
+ }, [resolvedDisabled]);
456
+ const indicatorPressAnimatedStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
457
+ const scale = (0, react_native_reanimated_1.interpolate)(pressSv.value, [0, 1], [1, PRESSED_SCALE]);
458
+ return { transform: [{ scale }] };
459
+ });
460
+ const focusRingAnimatedStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
461
+ return {
462
+ opacity: focusSv.value,
463
+ transform: [{ scale: (0, react_native_reanimated_1.interpolate)(focusSv.value, [0, 1], [0.96, 1]) }],
464
+ };
465
+ });
466
+ const indicatorAnimatedStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
467
+ return {
468
+ backgroundColor: (0, react_native_reanimated_1.interpolateColor)(checkedSv.value, [0, 1], [resolvedColors.uncheckedBackground, resolvedColors.checkedBackground]),
469
+ borderColor: (0, react_native_reanimated_1.interpolateColor)(checkedSv.value, [0, 1], [resolvedColors.uncheckedBorder, resolvedColors.checkedBorder]),
470
+ };
471
+ }, [resolvedColors]);
472
+ const indicatorFrameStyle = React.useMemo(() => ({
473
+ width: metrics.indicatorSize,
474
+ height: metrics.indicatorSize,
475
+ borderRadius: metrics.indicatorSize / 2,
476
+ borderWidth: metrics.indicatorBorderWidth,
477
+ }), [metrics.indicatorBorderWidth, metrics.indicatorSize]);
478
+ const indicatorNode = showIndicator ? ((0, jsx_runtime_1.jsxs)(react_native_reanimated_1.default.View, { style: [
479
+ styles.indicatorFrame,
480
+ indicatorFrameStyle,
481
+ indicatorPressAnimatedStyle,
482
+ indicatorAnimatedStyle,
483
+ indicatorStyle,
484
+ ], children: [(0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "none", style: [
485
+ styles.focusRing,
486
+ {
487
+ top: -metrics.focusRingOffset,
488
+ bottom: -metrics.focusRingOffset,
489
+ left: -metrics.focusRingOffset,
490
+ right: -metrics.focusRingOffset,
491
+ borderRadius: metrics.indicatorSize / 2 + metrics.focusRingOffset,
492
+ borderWidth: metrics.focusRingWidth,
493
+ borderColor: resolvedColors.focusRing,
494
+ },
495
+ focusRingAnimatedStyle,
496
+ ] }), (0, jsx_runtime_1.jsx)(RadioIndicator, {})] })) : null;
497
+ const hasContent = renderedContent != null;
498
+ const contentBeforeIndicator = (labelPlacement === 'start' && !isRTL) || (labelPlacement === 'end' && isRTL);
499
+ const contentNode = hasContent ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.content, contentStyle], children: contentBeforeIndicator ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.contentSlot, showIndicator ? { marginEnd: metrics.gap } : null], children: renderedContent }), indicatorNode] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [indicatorNode, (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.contentSlot, showIndicator ? { marginStart: metrics.gap } : null], children: renderedContent })] })) })) : (indicatorNode);
500
+ const inferredAccessibilityLabel = isPrimitiveText(label) ? String(label) : undefined;
501
+ const resolvedStyle = React.useCallback((state) => {
502
+ const userStyle = typeof style === 'function' ? style(state) : style;
503
+ return [styles.root, webCursorStyle, userStyle];
504
+ }, [style, webCursorStyle]);
505
+ return ((0, jsx_runtime_1.jsx)(RadioIndicatorContext.Provider, { value: indicatorContext, children: (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { ...pressableProps, ref: ref, accessibilityLabel: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : inferredAccessibilityLabel, accessibilityRole: "radio", accessibilityState: {
506
+ ...accessibilityState,
507
+ checked,
508
+ disabled: Boolean(resolvedDisabled),
509
+ }, disabled: resolvedDisabled, hitSlop: hitSlop !== null && hitSlop !== void 0 ? hitSlop : defaultHitSlop, onBlur: handleBlur, onFocus: handleFocus, onPress: handlePress, onPressIn: handlePressIn, onPressOut: handlePressOut, style: resolvedStyle, testID: testID, children: (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [styles.visual, visualAnimatedStyle], children: contentNode }) }) }));
510
+ }
511
+ const RadioWithRef = React.forwardRef(RadioImpl);
512
+ RadioWithRef.displayName = 'Radio';
513
+ exports.Radio = React.memo(RadioWithRef);
514
+ exports.Radio.displayName = 'Radio';
515
+ function RadioIndicator({ children, style }) {
516
+ const context = useRadioIndicatorContext();
517
+ const customIndicator = children !== null && children !== void 0 ? children : context.customIndicator;
518
+ const dotAnimatedStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
519
+ const opacity = context.checkedSv.value;
520
+ const scale = (0, react_native_reanimated_1.interpolate)(context.checkedSv.value, [0, 1], [0.72, 1]);
521
+ return { opacity, transform: [{ scale }] };
522
+ });
523
+ const resolvedCustomIndicator = isIndicatorRenderProp(customIndicator)
524
+ ? customIndicator(context.slot)
525
+ : customIndicator;
526
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: [
527
+ styles.indicatorLayer,
528
+ {
529
+ width: context.indicatorSize,
530
+ height: context.indicatorSize,
531
+ },
532
+ style,
533
+ ], children: (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: dotAnimatedStyle, children: resolvedCustomIndicator !== null && resolvedCustomIndicator !== void 0 ? resolvedCustomIndicator : ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
534
+ width: context.indicatorDotSize,
535
+ height: context.indicatorDotSize,
536
+ borderRadius: context.indicatorDotSize / 2,
537
+ backgroundColor: context.checkedIndicatorColor,
538
+ } })) }) }));
539
+ }
540
+ function RadioGroup({ value, defaultValue, onChange, disabled = false, allowDeselect = false, orientation = 'horizontal', align = 'start', wrap = false, gap, rowGap, columnGap, size, tone, variant, color, colors, layout, style, children, accessibilityState, ...viewProps }) {
541
+ var _a;
542
+ const { width: viewportWidth } = (0, react_native_1.useWindowDimensions)();
543
+ const isControlled = value !== undefined;
544
+ const storeRef = React.useRef(null);
545
+ if (!storeRef.current) {
546
+ storeRef.current = new RadioGroupStore(((_a = value !== null && value !== void 0 ? value : defaultValue) !== null && _a !== void 0 ? _a : null));
547
+ }
548
+ React.useLayoutEffect(() => {
549
+ if (!isControlled)
550
+ return;
551
+ storeRef.current.setValue((value !== null && value !== void 0 ? value : null));
552
+ }, [isControlled, value]);
553
+ const selectValue = React.useCallback((nextValue) => {
554
+ if (!isControlled)
555
+ storeRef.current.setValue(nextValue);
556
+ onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
557
+ }, [isControlled, onChange]);
558
+ const context = React.useMemo(() => ({
559
+ store: storeRef.current,
560
+ disabled,
561
+ isControlled,
562
+ allowDeselect,
563
+ selectValue,
564
+ size,
565
+ tone,
566
+ variant,
567
+ color,
568
+ colors,
569
+ layout,
570
+ }), [
571
+ allowDeselect,
572
+ color,
573
+ colors,
574
+ disabled,
575
+ isControlled,
576
+ layout,
577
+ selectValue,
578
+ size,
579
+ tone,
580
+ variant,
581
+ ]);
582
+ const defaultGap = React.useMemo(() => (0, zkit_tools_1.wp)(12), [viewportWidth]);
583
+ const resolvedGap = resolveNonNegativeNumber(gap, defaultGap);
584
+ const resolvedRowGap = resolveNonNegativeNumber(rowGap, resolvedGap);
585
+ const resolvedColumnGap = resolveNonNegativeNumber(columnGap, resolvedGap);
586
+ const layoutStyle = React.useMemo(() => ({
587
+ alignItems: resolveAlignItems(align),
588
+ columnGap: resolvedColumnGap,
589
+ flexDirection: orientation === 'vertical' ? 'column' : 'row',
590
+ flexWrap: wrap ? 'wrap' : 'nowrap',
591
+ rowGap: resolvedRowGap,
592
+ }), [align, orientation, resolvedColumnGap, resolvedRowGap, wrap]);
593
+ return ((0, jsx_runtime_1.jsx)(RadioGroupContext.Provider, { value: context, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { ...viewProps, accessibilityRole: "radiogroup", accessibilityState: {
594
+ ...accessibilityState,
595
+ disabled: Boolean(disabled),
596
+ }, style: [layoutStyle, style], children: children }) }));
597
+ }
598
+ const styles = react_native_1.StyleSheet.create({
599
+ root: {
600
+ alignSelf: 'flex-start',
601
+ },
602
+ visual: {
603
+ alignItems: 'center',
604
+ flexDirection: 'row',
605
+ minWidth: 0,
606
+ },
607
+ content: {
608
+ alignItems: 'center',
609
+ flexDirection: 'row',
610
+ minWidth: 0,
611
+ },
612
+ contentSlot: {
613
+ flexShrink: 1,
614
+ minWidth: 0,
615
+ },
616
+ copy: {
617
+ flexShrink: 1,
618
+ minWidth: 0,
619
+ },
620
+ indicatorFrame: {
621
+ alignItems: 'center',
622
+ flexShrink: 0,
623
+ justifyContent: 'center',
624
+ overflow: 'visible',
625
+ },
626
+ focusRing: {
627
+ position: 'absolute',
628
+ },
629
+ indicatorLayer: {
630
+ alignItems: 'center',
631
+ justifyContent: 'center',
632
+ },
633
+ });
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { SheetContent, SheetFooter, SheetHeader } from './slots';
3
+ import type { SheetProps, SheetRef } from './types';
4
+ export { SheetContent, SheetFooter, SheetHeader } from './slots';
5
+ export type { SheetAnimationConfig, SheetBackdropConfig, SheetCloseCompleteDetails, SheetCloseOptions, SheetCloseReason, SheetContentProps, SheetDetent, SheetDetentChangePayload, SheetFooterProps, SheetHandleConfig, SheetHeaderProps, SheetNativeProps, SheetOpenChangeDetails, SheetOpenChangeReason, SheetOpenCompleteDetails, SheetOpenOptions, SheetOpenReason, SheetPlacement, SheetProps, SheetRef, SheetRenderContext, SheetSafeAreaEdges, SheetSize, SheetState, } from './types';
6
+ type SheetComponent = React.ForwardRefExoticComponent<SheetProps & React.RefAttributes<SheetRef>> & {
7
+ Header: typeof SheetHeader;
8
+ Content: typeof SheetContent;
9
+ Footer: typeof SheetFooter;
10
+ };
11
+ export declare const Sheet: SheetComponent;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/Sheet/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwB/B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,KAAK,EAUV,UAAU,EACV,QAAQ,EAMT,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjE,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,SAAS,EACT,UAAU,GACX,MAAM,SAAS,CAAC;AA6/BjB,KAAK,cAAc,GAAG,KAAK,CAAC,yBAAyB,CACnD,UAAU,GAAG,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAC3C,GAAG;IACF,MAAM,EAAE,OAAO,WAAW,CAAC;IAC3B,OAAO,EAAE,OAAO,YAAY,CAAC;IAC7B,MAAM,EAAE,OAAO,WAAW,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,KAAK,EAIZ,cAAc,CAAC"}