@xaui/native 0.2.8 → 0.9.1-alpha.1

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 (234) hide show
  1. package/dist/chunk-KFCORXWW.cjs +150 -0
  2. package/dist/chunk-M7P46XKI.cjs +100 -0
  3. package/dist/chunk-N357EQCZ.js +150 -0
  4. package/dist/chunk-NHPQQQ7P.cjs +734 -0
  5. package/dist/chunk-PBVPOX7D.js +734 -0
  6. package/dist/chunk-RBNCR5KB.js +100 -0
  7. package/dist/index.cjs +40 -1
  8. package/dist/index.d.cts +5 -2
  9. package/dist/index.d.ts +5 -2
  10. package/dist/index.js +40 -0
  11. package/dist/system/index.cjs +7 -0
  12. package/dist/system/index.d.cts +83 -0
  13. package/dist/system/index.d.ts +83 -0
  14. package/dist/system/index.js +7 -0
  15. package/dist/theme/index.cjs +36 -0
  16. package/dist/theme/index.d.cts +539 -0
  17. package/dist/theme/index.d.ts +539 -0
  18. package/dist/theme/index.js +36 -0
  19. package/dist/theme.type-B3ODSLbB.d.cts +153 -0
  20. package/dist/theme.type-B3ODSLbB.d.ts +153 -0
  21. package/package.json +30 -248
  22. package/README.md +0 -178
  23. package/dist/alert/index.cjs +0 -340
  24. package/dist/alert/index.d.cts +0 -46
  25. package/dist/alert/index.d.ts +0 -46
  26. package/dist/alert/index.js +0 -340
  27. package/dist/app-bar/index.cjs +0 -148
  28. package/dist/app-bar/index.d.cts +0 -59
  29. package/dist/app-bar/index.d.ts +0 -59
  30. package/dist/app-bar/index.js +0 -148
  31. package/dist/autocomplete/index.cjs +0 -1122
  32. package/dist/autocomplete/index.d.cts +0 -88
  33. package/dist/autocomplete/index.d.ts +0 -88
  34. package/dist/autocomplete/index.js +0 -1122
  35. package/dist/avatar/index.cjs +0 -281
  36. package/dist/avatar/index.d.cts +0 -123
  37. package/dist/avatar/index.d.ts +0 -123
  38. package/dist/avatar/index.js +0 -281
  39. package/dist/badge/index.cjs +0 -197
  40. package/dist/badge/index.d.cts +0 -94
  41. package/dist/badge/index.d.ts +0 -94
  42. package/dist/badge/index.js +0 -197
  43. package/dist/bottom-sheet/index.cjs +0 -9
  44. package/dist/bottom-sheet/index.d.cts +0 -84
  45. package/dist/bottom-sheet/index.d.ts +0 -84
  46. package/dist/bottom-sheet/index.js +0 -9
  47. package/dist/bottom-tab-bar/index.cjs +0 -497
  48. package/dist/bottom-tab-bar/index.d.cts +0 -211
  49. package/dist/bottom-tab-bar/index.d.ts +0 -211
  50. package/dist/bottom-tab-bar/index.js +0 -497
  51. package/dist/button/index.cjs +0 -392
  52. package/dist/button/index.d.cts +0 -174
  53. package/dist/button/index.d.ts +0 -174
  54. package/dist/button/index.js +0 -392
  55. package/dist/button.type-j1ZdkkSl.d.cts +0 -4
  56. package/dist/button.type-j1ZdkkSl.d.ts +0 -4
  57. package/dist/card/index.cjs +0 -338
  58. package/dist/card/index.d.cts +0 -191
  59. package/dist/card/index.d.ts +0 -191
  60. package/dist/card/index.js +0 -338
  61. package/dist/carousel/index.cjs +0 -381
  62. package/dist/carousel/index.d.cts +0 -147
  63. package/dist/carousel/index.d.ts +0 -147
  64. package/dist/carousel/index.js +0 -381
  65. package/dist/chart/index.cjs +0 -1026
  66. package/dist/chart/index.d.cts +0 -218
  67. package/dist/chart/index.d.ts +0 -218
  68. package/dist/chart/index.js +0 -1026
  69. package/dist/checkbox/index.cjs +0 -443
  70. package/dist/checkbox/index.d.cts +0 -73
  71. package/dist/checkbox/index.d.ts +0 -73
  72. package/dist/checkbox/index.js +0 -443
  73. package/dist/chip/index.cjs +0 -503
  74. package/dist/chip/index.d.cts +0 -195
  75. package/dist/chip/index.d.ts +0 -195
  76. package/dist/chip/index.js +0 -503
  77. package/dist/chunk-4JFWQ5XT.js +0 -368
  78. package/dist/chunk-56RPWZD2.cjs +0 -9
  79. package/dist/chunk-7UFBLUMV.cjs +0 -136
  80. package/dist/chunk-A45TVXU5.js +0 -337
  81. package/dist/chunk-BYWUAPC4.cjs +0 -368
  82. package/dist/chunk-DECMUMCI.js +0 -0
  83. package/dist/chunk-DHSTKO3K.cjs +0 -19
  84. package/dist/chunk-DJ4Q37UT.cjs +0 -75
  85. package/dist/chunk-EUQDGTST.cjs +0 -1
  86. package/dist/chunk-GBHQCAKW.js +0 -19
  87. package/dist/chunk-RBSA4NH4.js +0 -136
  88. package/dist/chunk-SHBDANQN.js +0 -9
  89. package/dist/chunk-UGEINZM7.cjs +0 -290
  90. package/dist/chunk-UU4HHBDN.js +0 -290
  91. package/dist/chunk-VSZEXOUN.js +0 -384
  92. package/dist/chunk-YIEUN3G5.cjs +0 -384
  93. package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
  94. package/dist/chunk-ZY7IUTAT.js +0 -75
  95. package/dist/color-picker/index.cjs +0 -457
  96. package/dist/color-picker/index.d.cts +0 -124
  97. package/dist/color-picker/index.d.ts +0 -124
  98. package/dist/color-picker/index.js +0 -457
  99. package/dist/core/index.cjs +0 -24
  100. package/dist/core/index.d.cts +0 -28
  101. package/dist/core/index.d.ts +0 -28
  102. package/dist/core/index.js +0 -24
  103. package/dist/datepicker/index.cjs +0 -1625
  104. package/dist/datepicker/index.d.cts +0 -45
  105. package/dist/datepicker/index.d.ts +0 -45
  106. package/dist/datepicker/index.js +0 -1625
  107. package/dist/dialog/index.cjs +0 -372
  108. package/dist/dialog/index.d.cts +0 -151
  109. package/dist/dialog/index.d.ts +0 -151
  110. package/dist/dialog/index.js +0 -372
  111. package/dist/divider/index.cjs +0 -8
  112. package/dist/divider/index.d.cts +0 -30
  113. package/dist/divider/index.d.ts +0 -30
  114. package/dist/divider/index.js +0 -8
  115. package/dist/drawer/index.cjs +0 -237
  116. package/dist/drawer/index.d.cts +0 -58
  117. package/dist/drawer/index.d.ts +0 -58
  118. package/dist/drawer/index.js +0 -237
  119. package/dist/expansion-panel/index.cjs +0 -441
  120. package/dist/expansion-panel/index.d.cts +0 -153
  121. package/dist/expansion-panel/index.d.ts +0 -153
  122. package/dist/expansion-panel/index.js +0 -441
  123. package/dist/fab/index.cjs +0 -9
  124. package/dist/fab/index.d.cts +0 -10
  125. package/dist/fab/index.d.ts +0 -10
  126. package/dist/fab/index.js +0 -9
  127. package/dist/fab-menu/index.cjs +0 -330
  128. package/dist/fab-menu/index.d.cts +0 -125
  129. package/dist/fab-menu/index.d.ts +0 -125
  130. package/dist/fab-menu/index.js +0 -330
  131. package/dist/fab.type-CkUHmXU_.d.ts +0 -86
  132. package/dist/fab.type-DN0vtAh6.d.cts +0 -86
  133. package/dist/feature-discovery/index.cjs +0 -464
  134. package/dist/feature-discovery/index.d.cts +0 -82
  135. package/dist/feature-discovery/index.d.ts +0 -82
  136. package/dist/feature-discovery/index.js +0 -464
  137. package/dist/indicator/index.cjs +0 -8
  138. package/dist/indicator/index.d.cts +0 -47
  139. package/dist/indicator/index.d.ts +0 -47
  140. package/dist/indicator/index.js +0 -8
  141. package/dist/input/index.cjs +0 -1462
  142. package/dist/input/index.d.cts +0 -522
  143. package/dist/input/index.d.ts +0 -522
  144. package/dist/input/index.js +0 -1462
  145. package/dist/input-trigger/index.cjs +0 -197
  146. package/dist/input-trigger/index.d.cts +0 -11
  147. package/dist/input-trigger/index.d.ts +0 -11
  148. package/dist/input-trigger/index.js +0 -197
  149. package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
  150. package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
  151. package/dist/list/index.cjs +0 -395
  152. package/dist/list/index.d.cts +0 -188
  153. package/dist/list/index.d.ts +0 -188
  154. package/dist/list/index.js +0 -395
  155. package/dist/menu/index.cjs +0 -316
  156. package/dist/menu/index.d.cts +0 -115
  157. package/dist/menu/index.d.ts +0 -115
  158. package/dist/menu/index.js +0 -316
  159. package/dist/menubox/index.cjs +0 -297
  160. package/dist/menubox/index.d.cts +0 -98
  161. package/dist/menubox/index.d.ts +0 -98
  162. package/dist/menubox/index.js +0 -297
  163. package/dist/pager/index.cjs +0 -205
  164. package/dist/pager/index.d.cts +0 -93
  165. package/dist/pager/index.d.ts +0 -93
  166. package/dist/pager/index.js +0 -205
  167. package/dist/picker/index.cjs +0 -244
  168. package/dist/picker/index.d.cts +0 -121
  169. package/dist/picker/index.d.ts +0 -121
  170. package/dist/picker/index.js +0 -244
  171. package/dist/progress/index.cjs +0 -219
  172. package/dist/progress/index.d.cts +0 -47
  173. package/dist/progress/index.d.ts +0 -47
  174. package/dist/progress/index.js +0 -219
  175. package/dist/radio/index.cjs +0 -465
  176. package/dist/radio/index.d.cts +0 -145
  177. package/dist/radio/index.d.ts +0 -145
  178. package/dist/radio/index.js +0 -465
  179. package/dist/refresh-control/index.cjs +0 -45
  180. package/dist/refresh-control/index.d.cts +0 -55
  181. package/dist/refresh-control/index.d.ts +0 -55
  182. package/dist/refresh-control/index.js +0 -45
  183. package/dist/segment-button/index.cjs +0 -405
  184. package/dist/segment-button/index.d.cts +0 -141
  185. package/dist/segment-button/index.d.ts +0 -141
  186. package/dist/segment-button/index.js +0 -405
  187. package/dist/select/index.cjs +0 -878
  188. package/dist/select/index.d.cts +0 -192
  189. package/dist/select/index.d.ts +0 -192
  190. package/dist/select/index.js +0 -878
  191. package/dist/skeleton/index.cjs +0 -89
  192. package/dist/skeleton/index.d.cts +0 -45
  193. package/dist/skeleton/index.d.ts +0 -45
  194. package/dist/skeleton/index.js +0 -89
  195. package/dist/slider/index.cjs +0 -576
  196. package/dist/slider/index.d.cts +0 -171
  197. package/dist/slider/index.d.ts +0 -171
  198. package/dist/slider/index.js +0 -576
  199. package/dist/snackbar/index.cjs +0 -436
  200. package/dist/snackbar/index.d.cts +0 -174
  201. package/dist/snackbar/index.d.ts +0 -174
  202. package/dist/snackbar/index.js +0 -436
  203. package/dist/snippet/index.cjs +0 -314
  204. package/dist/snippet/index.d.cts +0 -95
  205. package/dist/snippet/index.d.ts +0 -95
  206. package/dist/snippet/index.js +0 -314
  207. package/dist/stepper/index.cjs +0 -550
  208. package/dist/stepper/index.d.cts +0 -137
  209. package/dist/stepper/index.d.ts +0 -137
  210. package/dist/stepper/index.js +0 -550
  211. package/dist/switch/index.cjs +0 -358
  212. package/dist/switch/index.d.cts +0 -28
  213. package/dist/switch/index.d.ts +0 -28
  214. package/dist/switch/index.js +0 -358
  215. package/dist/tabs/index.cjs +0 -440
  216. package/dist/tabs/index.d.cts +0 -180
  217. package/dist/tabs/index.d.ts +0 -180
  218. package/dist/tabs/index.js +0 -440
  219. package/dist/timepicker/index.cjs +0 -823
  220. package/dist/timepicker/index.d.cts +0 -215
  221. package/dist/timepicker/index.d.ts +0 -215
  222. package/dist/timepicker/index.js +0 -823
  223. package/dist/toolbar/index.cjs +0 -333
  224. package/dist/toolbar/index.d.cts +0 -100
  225. package/dist/toolbar/index.d.ts +0 -100
  226. package/dist/toolbar/index.js +0 -333
  227. package/dist/typography/index.cjs +0 -238
  228. package/dist/typography/index.d.cts +0 -113
  229. package/dist/typography/index.d.ts +0 -113
  230. package/dist/typography/index.js +0 -238
  231. package/dist/view/index.cjs +0 -1361
  232. package/dist/view/index.d.cts +0 -833
  233. package/dist/view/index.d.ts +0 -833
  234. package/dist/view/index.js +0 -1361
@@ -1,457 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkZH6ZSV2Qcjs = require('../chunk-ZH6ZSV2Q.cjs');
4
-
5
-
6
- var _chunkBYWUAPC4cjs = require('../chunk-BYWUAPC4.cjs');
7
- require('../chunk-56RPWZD2.cjs');
8
-
9
-
10
- var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
11
-
12
- // src/components/color-picker/color-picker.tsx
13
- var _react = require('react'); var _react2 = _interopRequireDefault(_react);
14
- var _reactnative = require('react-native');
15
- var _core = require('@xaui/core');
16
-
17
- // src/components/color-picker/color-picker.palette.ts
18
- var defaultColorGroups = [
19
- {
20
- name: "Red",
21
- colors: [
22
- "#fef2f2",
23
- "#fecaca",
24
- "#f87171",
25
- "#ef4444",
26
- "#dc2626",
27
- "#b91c1c",
28
- "#991b1b",
29
- "#7f1d1d"
30
- ]
31
- },
32
- {
33
- name: "Orange",
34
- colors: [
35
- "#fff7ed",
36
- "#fed7aa",
37
- "#fb923c",
38
- "#f97316",
39
- "#ea580c",
40
- "#c2410c",
41
- "#9a3412",
42
- "#7c2d12"
43
- ]
44
- },
45
- {
46
- name: "Amber",
47
- colors: [
48
- "#fffbeb",
49
- "#fde68a",
50
- "#fbbf24",
51
- "#f59e0b",
52
- "#d97706",
53
- "#b45309",
54
- "#92400e",
55
- "#78350f"
56
- ]
57
- },
58
- {
59
- name: "Yellow",
60
- colors: [
61
- "#fefce8",
62
- "#fef08a",
63
- "#facc15",
64
- "#eab308",
65
- "#ca8a04",
66
- "#a16207",
67
- "#854d0e",
68
- "#713f12"
69
- ]
70
- },
71
- {
72
- name: "Lime",
73
- colors: [
74
- "#f7fee7",
75
- "#d9f99d",
76
- "#86efac",
77
- "#4ade80",
78
- "#22c55e",
79
- "#16a34a",
80
- "#15803d",
81
- "#14532d"
82
- ]
83
- },
84
- {
85
- name: "Green",
86
- colors: [
87
- "#f0fdf4",
88
- "#bbf7d0",
89
- "#4ade80",
90
- "#22c55e",
91
- "#16a34a",
92
- "#15803d",
93
- "#166534",
94
- "#14532d"
95
- ]
96
- },
97
- {
98
- name: "Teal",
99
- colors: [
100
- "#f0fdfa",
101
- "#99f6e4",
102
- "#2dd4bf",
103
- "#14b8a6",
104
- "#0d9488",
105
- "#0f766e",
106
- "#115e59",
107
- "#134e4a"
108
- ]
109
- },
110
- {
111
- name: "Cyan",
112
- colors: [
113
- "#ecfeff",
114
- "#a5f3fc",
115
- "#22d3ee",
116
- "#06b6d4",
117
- "#0891b2",
118
- "#0e7490",
119
- "#155e75",
120
- "#164e63"
121
- ]
122
- },
123
- {
124
- name: "Blue",
125
- colors: [
126
- "#eff6ff",
127
- "#bfdbfe",
128
- "#60a5fa",
129
- "#3b82f6",
130
- "#2563eb",
131
- "#1d4ed8",
132
- "#1e40af",
133
- "#1e3a8a"
134
- ]
135
- },
136
- {
137
- name: "Indigo",
138
- colors: [
139
- "#eef2ff",
140
- "#c7d2fe",
141
- "#818cf8",
142
- "#6366f1",
143
- "#4f46e5",
144
- "#4338ca",
145
- "#3730a3",
146
- "#312e81"
147
- ]
148
- },
149
- {
150
- name: "Violet",
151
- colors: [
152
- "#f5f3ff",
153
- "#ddd6fe",
154
- "#a78bfa",
155
- "#8b5cf6",
156
- "#7c3aed",
157
- "#6d28d9",
158
- "#5b21b6",
159
- "#4c1d95"
160
- ]
161
- },
162
- {
163
- name: "Purple",
164
- colors: [
165
- "#faf5ff",
166
- "#e9d5ff",
167
- "#c084fc",
168
- "#a855f7",
169
- "#9333ea",
170
- "#7e22ce",
171
- "#6b21a8",
172
- "#581c87"
173
- ]
174
- },
175
- {
176
- name: "Pink",
177
- colors: [
178
- "#fdf2f8",
179
- "#fbcfe8",
180
- "#f472b6",
181
- "#ec4899",
182
- "#db2777",
183
- "#be185d",
184
- "#9d174d",
185
- "#831843"
186
- ]
187
- },
188
- {
189
- name: "Rose",
190
- colors: [
191
- "#fff1f2",
192
- "#fecdd3",
193
- "#fb7185",
194
- "#f43f5e",
195
- "#e11d48",
196
- "#be123c",
197
- "#9f1239",
198
- "#881337"
199
- ]
200
- },
201
- {
202
- name: "Neutral",
203
- colors: [
204
- "#fafafa",
205
- "#f5f5f5",
206
- "#e5e5e5",
207
- "#d4d4d4",
208
- "#a3a3a3",
209
- "#737373",
210
- "#525252",
211
- "#404040",
212
- "#262626",
213
- "#171717",
214
- "#0a0a0a"
215
- ]
216
- }
217
- ];
218
-
219
- // src/components/color-picker/color-picker.style.ts
220
-
221
- var styles = _reactnative.StyleSheet.create({
222
- sheetContent: {
223
- flex: 1,
224
- paddingBottom: 24
225
- },
226
- header: {
227
- paddingHorizontal: 20,
228
- paddingTop: 4,
229
- paddingBottom: 16,
230
- flexDirection: "row",
231
- alignItems: "center",
232
- justifyContent: "space-between"
233
- },
234
- sheetTitle: {
235
- fontSize: 16,
236
- fontWeight: "600"
237
- },
238
- selectedPreview: {
239
- flexDirection: "row",
240
- alignItems: "center",
241
- gap: 8
242
- },
243
- previewSwatch: {
244
- width: 28,
245
- height: 28,
246
- borderRadius: 14,
247
- borderWidth: 2
248
- },
249
- hexLabel: {
250
- fontSize: 13,
251
- fontWeight: "500",
252
- letterSpacing: 0.5
253
- },
254
- groupContainer: {
255
- marginBottom: 16,
256
- paddingHorizontal: 20
257
- },
258
- groupName: {
259
- fontSize: 13,
260
- fontWeight: "500",
261
- marginBottom: 8
262
- },
263
- swatchRow: {
264
- flexDirection: "row",
265
- flexWrap: "wrap",
266
- gap: 8
267
- },
268
- triggerSwatch: {
269
- width: 22,
270
- height: 22,
271
- borderRadius: 4,
272
- borderWidth: 1
273
- }
274
- });
275
-
276
- // src/components/color-picker/color-picker.tsx
277
- var Swatch = ({
278
- color,
279
- size,
280
- isSelected,
281
- onSelect,
282
- borderColor
283
- }) => /* @__PURE__ */ _react2.default.createElement(
284
- _reactnative.Pressable,
285
- {
286
- onPress: () => onSelect(color),
287
- accessibilityRole: "button",
288
- accessibilityLabel: color,
289
- accessibilityState: { selected: isSelected },
290
- style: [
291
- {
292
- width: size,
293
- height: size,
294
- borderRadius: 6,
295
- backgroundColor: color,
296
- borderWidth: isSelected ? 3 : 1,
297
- borderColor: isSelected ? borderColor : _core.withOpacity.call(void 0, borderColor, 0.15)
298
- }
299
- ]
300
- }
301
- );
302
- var ColorGroupSection = ({
303
- group,
304
- selectedColor,
305
- swatchSize,
306
- themeMain,
307
- foreground,
308
- onSelect
309
- }) => /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.groupContainer }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.groupName, { color: _core.withOpacity.call(void 0, foreground, 0.6) }] }, group.name), /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.swatchRow }, group.colors.map((color) => /* @__PURE__ */ _react2.default.createElement(
310
- Swatch,
311
- {
312
- key: color,
313
- color,
314
- size: swatchSize,
315
- isSelected: color === selectedColor,
316
- onSelect,
317
- borderColor: color === selectedColor ? themeMain : foreground
318
- }
319
- ))));
320
- var ColorPicker = ({
321
- value,
322
- placeholder = "Pick a color...",
323
- label,
324
- labelPlacement = "outside",
325
- description,
326
- errorMessage,
327
- colorGroups = defaultColorGroups,
328
- sheetTitle = "Pick a color",
329
- themeColor = "primary",
330
- variant = "colored",
331
- size = "md",
332
- radius = "md",
333
- isOpened,
334
- isDisabled = false,
335
- isInvalid = false,
336
- fullWidth = true,
337
- sheetStyle,
338
- swatchSize = 28,
339
- onColorChange,
340
- onOpenChange,
341
- onClose
342
- }) => {
343
- const [isOpen, setIsOpen] = _react.useState.call(void 0, _nullishCoalesce(isOpened, () => ( false)));
344
- const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
345
- const sheetBackground = theme.mode === "dark" ? theme.colors.background : "#ffffff";
346
- _react.useEffect.call(void 0, () => {
347
- if (isOpened !== void 0) {
348
- setIsOpen(isOpened);
349
- }
350
- }, [isOpened]);
351
- const handleOpen = () => {
352
- if (isDisabled) return;
353
- setIsOpen(true);
354
- _optionalChain([onOpenChange, 'optionalCall', _ => _(true)]);
355
- };
356
- const handleClose = () => {
357
- setIsOpen(false);
358
- _optionalChain([onOpenChange, 'optionalCall', _2 => _2(false)]);
359
- _optionalChain([onClose, 'optionalCall', _3 => _3()]);
360
- };
361
- const handleSelect = (color) => {
362
- _optionalChain([onColorChange, 'optionalCall', _4 => _4(color)]);
363
- handleClose();
364
- };
365
- const triggerColor = value;
366
- const foreground = theme.colors.foreground;
367
- const themeMain = _nullishCoalesce(_optionalChain([theme, 'access', _5 => _5.colors, 'access', _6 => _6[themeColor], 'optionalAccess', _7 => _7.main]), () => ( foreground));
368
- const triggerEndContent = /* @__PURE__ */ _react2.default.createElement(
369
- _reactnative.View,
370
- {
371
- style: [
372
- styles.triggerSwatch,
373
- {
374
- backgroundColor: _nullishCoalesce(triggerColor, () => ( "transparent")),
375
- borderColor: triggerColor ? _core.withOpacity.call(void 0, foreground, 0.2) : _core.withOpacity.call(void 0, foreground, 0.15),
376
- borderStyle: triggerColor ? "solid" : "dashed"
377
- }
378
- ]
379
- }
380
- );
381
- return /* @__PURE__ */ _react2.default.createElement(_react2.default.Fragment, null, /* @__PURE__ */ _react2.default.createElement(
382
- _chunkZH6ZSV2Qcjs.InputTrigger,
383
- {
384
- value: value ? "" : void 0,
385
- placeholder,
386
- label,
387
- labelPlacement,
388
- description,
389
- errorMessage,
390
- themeColor,
391
- variant,
392
- size,
393
- radius,
394
- isDisabled,
395
- isInvalid,
396
- fullWidth,
397
- startContent: triggerEndContent,
398
- endContent: value ? /* @__PURE__ */ _react2.default.createElement(
399
- _reactnative.Text,
400
- {
401
- style: [
402
- {
403
- fontSize: 13,
404
- fontWeight: "500",
405
- letterSpacing: 0.5,
406
- color: _core.withOpacity.call(void 0, foreground, 0.6)
407
- }
408
- ]
409
- },
410
- value.toUpperCase()
411
- ) : void 0,
412
- onPress: handleOpen
413
- }
414
- ), /* @__PURE__ */ _react2.default.createElement(
415
- _chunkBYWUAPC4cjs.BottomSheet,
416
- {
417
- isOpen,
418
- snapPoints: [0.75],
419
- themeColor,
420
- onClose: handleClose,
421
- style: { backgroundColor: sheetBackground, ...sheetStyle }
422
- },
423
- /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.sheetContent }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.header }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.sheetTitle, { color: foreground }] }, sheetTitle), value && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.selectedPreview }, /* @__PURE__ */ _react2.default.createElement(
424
- _reactnative.View,
425
- {
426
- style: [
427
- styles.previewSwatch,
428
- {
429
- backgroundColor: value,
430
- borderColor: _core.withOpacity.call(void 0, foreground, 0.2)
431
- }
432
- ]
433
- }
434
- ), /* @__PURE__ */ _react2.default.createElement(
435
- _reactnative.Text,
436
- {
437
- style: [styles.hexLabel, { color: _core.withOpacity.call(void 0, foreground, 0.7) }]
438
- },
439
- value.toUpperCase()
440
- ))), /* @__PURE__ */ _react2.default.createElement(_reactnative.ScrollView, { showsVerticalScrollIndicator: false }, colorGroups.map((group) => /* @__PURE__ */ _react2.default.createElement(
441
- ColorGroupSection,
442
- {
443
- key: group.name,
444
- group,
445
- selectedColor: value,
446
- swatchSize,
447
- themeMain,
448
- foreground,
449
- onSelect: handleSelect
450
- }
451
- ))))
452
- ));
453
- };
454
-
455
-
456
-
457
- exports.ColorPicker = ColorPicker; exports.defaultColorGroups = defaultColorGroups;
@@ -1,124 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { ViewStyle } from 'react-native';
3
- import { ThemeColor, Radius } from '@xaui/core/types';
4
- import { d as InputTriggerLabelPlacement, b as InputTriggerVariant, c as InputTriggerSize } from '../input-trigger.type-Ba4bM3Qp.cjs';
5
-
6
- type ColorGroup = {
7
- /**
8
- * Display name of the color group.
9
- */
10
- name: string;
11
- /**
12
- * Array of hex color strings.
13
- */
14
- colors: string[];
15
- };
16
- type ColorPickerProps = {
17
- /**
18
- * Currently selected color (hex string).
19
- */
20
- value?: string;
21
- /**
22
- * Placeholder text shown when no color is selected.
23
- * @default 'Pick a color...'
24
- */
25
- placeholder?: string;
26
- /**
27
- * Label displayed above or inside the trigger.
28
- */
29
- label?: ReactNode;
30
- /**
31
- * Position of the label relative to the trigger.
32
- * @default 'outside'
33
- */
34
- labelPlacement?: InputTriggerLabelPlacement;
35
- /**
36
- * Helper text displayed below the trigger.
37
- */
38
- description?: ReactNode;
39
- /**
40
- * Error message when isInvalid is true.
41
- */
42
- errorMessage?: ReactNode;
43
- /**
44
- * Custom color groups. If not provided, uses the built-in Tailwind palette.
45
- */
46
- colorGroups?: ColorGroup[];
47
- /**
48
- * Title displayed at the top of the color sheet.
49
- * @default 'Pick a color'
50
- */
51
- sheetTitle?: string;
52
- /**
53
- * Theme color for selected state highlight and trigger.
54
- * @default 'primary'
55
- */
56
- themeColor?: ThemeColor;
57
- /**
58
- * Visual variant of the trigger.
59
- * @default 'flat'
60
- */
61
- variant?: InputTriggerVariant;
62
- /**
63
- * Size of the trigger.
64
- * @default 'md'
65
- */
66
- size?: InputTriggerSize;
67
- /**
68
- * Border radius.
69
- * @default 'md'
70
- */
71
- radius?: Radius;
72
- /**
73
- * Controlled open state.
74
- */
75
- isOpened?: boolean;
76
- /**
77
- * Whether the trigger is disabled.
78
- * @default false
79
- */
80
- isDisabled?: boolean;
81
- /**
82
- * Whether the trigger is in an invalid state.
83
- * @default false
84
- */
85
- isInvalid?: boolean;
86
- /**
87
- * Whether the trigger takes the full available width.
88
- * @default true
89
- */
90
- fullWidth?: boolean;
91
- /**
92
- * Custom style for the bottom sheet container.
93
- */
94
- sheetStyle?: ViewStyle;
95
- /**
96
- * Size of each color swatch in the palette.
97
- * @default 28
98
- */
99
- swatchSize?: number;
100
- } & ColorPickerEvents;
101
- type ColorPickerEvents = {
102
- /**
103
- * Called when the selected color changes.
104
- *
105
- * Note: This handler is named `onColorChange` instead of the more generic
106
- * `onValueChange` (used by other picker components) to emphasize that the
107
- * value is specifically a color string (e.g. `#RRGGBB`).
108
- */
109
- onColorChange?: (color: string) => void;
110
- /**
111
- * Called when the sheet opens or closes.
112
- */
113
- onOpenChange?: (isOpen: boolean) => void;
114
- /**
115
- * Called when the sheet closes.
116
- */
117
- onClose?: () => void;
118
- };
119
-
120
- declare const ColorPicker: React.FC<ColorPickerProps>;
121
-
122
- declare const defaultColorGroups: ColorGroup[];
123
-
124
- export { type ColorGroup, ColorPicker, type ColorPickerEvents, type ColorPickerProps, defaultColorGroups };
@@ -1,124 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { ViewStyle } from 'react-native';
3
- import { ThemeColor, Radius } from '@xaui/core/types';
4
- import { d as InputTriggerLabelPlacement, b as InputTriggerVariant, c as InputTriggerSize } from '../input-trigger.type-Ba4bM3Qp.js';
5
-
6
- type ColorGroup = {
7
- /**
8
- * Display name of the color group.
9
- */
10
- name: string;
11
- /**
12
- * Array of hex color strings.
13
- */
14
- colors: string[];
15
- };
16
- type ColorPickerProps = {
17
- /**
18
- * Currently selected color (hex string).
19
- */
20
- value?: string;
21
- /**
22
- * Placeholder text shown when no color is selected.
23
- * @default 'Pick a color...'
24
- */
25
- placeholder?: string;
26
- /**
27
- * Label displayed above or inside the trigger.
28
- */
29
- label?: ReactNode;
30
- /**
31
- * Position of the label relative to the trigger.
32
- * @default 'outside'
33
- */
34
- labelPlacement?: InputTriggerLabelPlacement;
35
- /**
36
- * Helper text displayed below the trigger.
37
- */
38
- description?: ReactNode;
39
- /**
40
- * Error message when isInvalid is true.
41
- */
42
- errorMessage?: ReactNode;
43
- /**
44
- * Custom color groups. If not provided, uses the built-in Tailwind palette.
45
- */
46
- colorGroups?: ColorGroup[];
47
- /**
48
- * Title displayed at the top of the color sheet.
49
- * @default 'Pick a color'
50
- */
51
- sheetTitle?: string;
52
- /**
53
- * Theme color for selected state highlight and trigger.
54
- * @default 'primary'
55
- */
56
- themeColor?: ThemeColor;
57
- /**
58
- * Visual variant of the trigger.
59
- * @default 'flat'
60
- */
61
- variant?: InputTriggerVariant;
62
- /**
63
- * Size of the trigger.
64
- * @default 'md'
65
- */
66
- size?: InputTriggerSize;
67
- /**
68
- * Border radius.
69
- * @default 'md'
70
- */
71
- radius?: Radius;
72
- /**
73
- * Controlled open state.
74
- */
75
- isOpened?: boolean;
76
- /**
77
- * Whether the trigger is disabled.
78
- * @default false
79
- */
80
- isDisabled?: boolean;
81
- /**
82
- * Whether the trigger is in an invalid state.
83
- * @default false
84
- */
85
- isInvalid?: boolean;
86
- /**
87
- * Whether the trigger takes the full available width.
88
- * @default true
89
- */
90
- fullWidth?: boolean;
91
- /**
92
- * Custom style for the bottom sheet container.
93
- */
94
- sheetStyle?: ViewStyle;
95
- /**
96
- * Size of each color swatch in the palette.
97
- * @default 28
98
- */
99
- swatchSize?: number;
100
- } & ColorPickerEvents;
101
- type ColorPickerEvents = {
102
- /**
103
- * Called when the selected color changes.
104
- *
105
- * Note: This handler is named `onColorChange` instead of the more generic
106
- * `onValueChange` (used by other picker components) to emphasize that the
107
- * value is specifically a color string (e.g. `#RRGGBB`).
108
- */
109
- onColorChange?: (color: string) => void;
110
- /**
111
- * Called when the sheet opens or closes.
112
- */
113
- onOpenChange?: (isOpen: boolean) => void;
114
- /**
115
- * Called when the sheet closes.
116
- */
117
- onClose?: () => void;
118
- };
119
-
120
- declare const ColorPicker: React.FC<ColorPickerProps>;
121
-
122
- declare const defaultColorGroups: ColorGroup[];
123
-
124
- export { type ColorGroup, ColorPicker, type ColorPickerEvents, type ColorPickerProps, defaultColorGroups };