@xaui/native 0.0.32 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bottom-sheet/index.cjs +4 -3
- package/dist/bottom-sheet/index.js +2 -1
- package/dist/chunk-2ANGPYCP.cjs +308 -0
- package/dist/chunk-DECMUMCI.js +0 -0
- package/dist/chunk-E4DOPNVW.js +308 -0
- package/dist/chunk-EUQDGTST.cjs +1 -0
- package/dist/color-picker/index.cjs +460 -0
- package/dist/color-picker/index.d.cts +124 -0
- package/dist/color-picker/index.d.ts +124 -0
- package/dist/color-picker/index.js +460 -0
- package/dist/input-trigger/index.cjs +8 -0
- package/dist/input-trigger/index.d.cts +9 -0
- package/dist/input-trigger/index.d.ts +9 -0
- package/dist/input-trigger/index.js +8 -0
- package/dist/input-trigger.type-BL70fHE9.d.cts +97 -0
- package/dist/input-trigger.type-BODYStHk.d.ts +97 -0
- package/dist/picker/index.cjs +250 -0
- package/dist/picker/index.d.cts +121 -0
- package/dist/picker/index.d.ts +121 -0
- package/dist/picker/index.js +250 -0
- package/dist/timepicker/index.cjs +4 -3
- package/dist/timepicker/index.js +2 -1
- package/package.json +16 -1
- /package/dist/{chunk-HC2SSHNU.js → chunk-ED22WCCI.js} +0 -0
- /package/dist/{chunk-XFPPR2VB.cjs → chunk-RVR42THG.cjs} +0 -0
|
@@ -0,0 +1,460 @@
|
|
|
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 _chunk2ANGPYCPcjs = require('../chunk-2ANGPYCP.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkRVR42THGcjs = require('../chunk-RVR42THG.cjs');
|
|
7
|
+
require('../chunk-HSPTLUFA.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.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 = "flat",
|
|
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 = _chunkOQ2BLOOGcjs.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
|
+
_chunk2ANGPYCPcjs.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
|
+
_chunkRVR42THGcjs.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: [
|
|
438
|
+
styles.hexLabel,
|
|
439
|
+
{ color: _core.withOpacity.call(void 0, foreground, 0.7) }
|
|
440
|
+
]
|
|
441
|
+
},
|
|
442
|
+
value.toUpperCase()
|
|
443
|
+
))), /* @__PURE__ */ _react2.default.createElement(_reactnative.ScrollView, { showsVerticalScrollIndicator: false }, colorGroups.map((group) => /* @__PURE__ */ _react2.default.createElement(
|
|
444
|
+
ColorGroupSection,
|
|
445
|
+
{
|
|
446
|
+
key: group.name,
|
|
447
|
+
group,
|
|
448
|
+
selectedColor: value,
|
|
449
|
+
swatchSize,
|
|
450
|
+
themeMain,
|
|
451
|
+
foreground,
|
|
452
|
+
onSelect: handleSelect
|
|
453
|
+
}
|
|
454
|
+
))))
|
|
455
|
+
));
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
exports.ColorPicker = ColorPicker; exports.defaultColorGroups = defaultColorGroups;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
import { T as ThemeColor, R as Radius } from '../index-DyU3sW3_.cjs';
|
|
4
|
+
import { d as InputTriggerLabelPlacement, b as InputTriggerVariant, c as InputTriggerSize } from '../input-trigger.type-BL70fHE9.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 };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
import { T as ThemeColor, R as Radius } from '../index-DyU3sW3_.js';
|
|
4
|
+
import { d as InputTriggerLabelPlacement, b as InputTriggerVariant, c as InputTriggerSize } from '../input-trigger.type-BODYStHk.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 };
|