@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
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-EUQDGTST.cjs');
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
var _chunkRVR42THGcjs = require('../chunk-RVR42THG.cjs');
|
|
4
5
|
require('../chunk-HSPTLUFA.cjs');
|
|
5
6
|
require('../chunk-OQ2BLOOG.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
exports.BottomSheet =
|
|
9
|
+
exports.BottomSheet = _chunkRVR42THGcjs.BottomSheet;
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunkOQ2BLOOGcjs = require('./chunk-OQ2BLOOG.cjs');
|
|
4
|
+
|
|
5
|
+
// src/components/input-trigger/input-trigger.tsx
|
|
6
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
7
|
+
var _reactnative = require('react-native');
|
|
8
|
+
|
|
9
|
+
// src/components/input-trigger/input-trigger.hook.ts
|
|
10
|
+
|
|
11
|
+
var _core = require('@xaui/core');
|
|
12
|
+
var sizeMap = {
|
|
13
|
+
sm: {
|
|
14
|
+
minHeight: 40,
|
|
15
|
+
fontSize: 14,
|
|
16
|
+
paddingHorizontal: 12,
|
|
17
|
+
paddingVertical: 8,
|
|
18
|
+
slotGap: 8,
|
|
19
|
+
labelSize: 13,
|
|
20
|
+
helperSize: 12
|
|
21
|
+
},
|
|
22
|
+
md: {
|
|
23
|
+
minHeight: 46,
|
|
24
|
+
fontSize: 16,
|
|
25
|
+
paddingHorizontal: 14,
|
|
26
|
+
paddingVertical: 10,
|
|
27
|
+
slotGap: 10,
|
|
28
|
+
labelSize: 14,
|
|
29
|
+
helperSize: 13
|
|
30
|
+
},
|
|
31
|
+
lg: {
|
|
32
|
+
minHeight: 52,
|
|
33
|
+
fontSize: 17,
|
|
34
|
+
paddingHorizontal: 16,
|
|
35
|
+
paddingVertical: 12,
|
|
36
|
+
slotGap: 12,
|
|
37
|
+
labelSize: 15,
|
|
38
|
+
helperSize: 15
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var useInputTriggerSizeStyles = (size) => _react.useMemo.call(void 0, () => sizeMap[size], [size]);
|
|
42
|
+
var useInputTriggerRadiusStyles = (radius) => {
|
|
43
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
44
|
+
return _react.useMemo.call(void 0, () => {
|
|
45
|
+
if (radius === "full") {
|
|
46
|
+
return { borderRadius: theme.borderRadius.full };
|
|
47
|
+
}
|
|
48
|
+
return { borderRadius: theme.borderRadius[radius] };
|
|
49
|
+
}, [radius, theme.borderRadius]);
|
|
50
|
+
};
|
|
51
|
+
var useInputTriggerVariantStyles = ({
|
|
52
|
+
themeColor,
|
|
53
|
+
variant,
|
|
54
|
+
isInvalid,
|
|
55
|
+
isDisabled
|
|
56
|
+
}) => {
|
|
57
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
58
|
+
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
59
|
+
const colorScheme = theme.colors[safeThemeColor];
|
|
60
|
+
return _react.useMemo.call(void 0, () => {
|
|
61
|
+
const neutralBorder = _core.withOpacity.call(void 0, theme.colors.foreground, 0.1);
|
|
62
|
+
const textColor = isDisabled ? _core.withOpacity.call(void 0, theme.colors.foreground, 0.55) : theme.colors.foreground;
|
|
63
|
+
const placeholderColor = _core.withOpacity.call(void 0, theme.colors.foreground, 0.45);
|
|
64
|
+
const labelColor = isInvalid ? theme.colors.danger.main : _core.withOpacity.call(void 0, theme.colors.foreground, 0.8);
|
|
65
|
+
const helperColor = isInvalid ? theme.colors.danger.main : _core.withOpacity.call(void 0, theme.colors.foreground, 0.72);
|
|
66
|
+
if (variant === "underlined") {
|
|
67
|
+
return {
|
|
68
|
+
container: {
|
|
69
|
+
backgroundColor: "transparent",
|
|
70
|
+
borderBottomWidth: isInvalid ? 2 : 1,
|
|
71
|
+
borderColor: isInvalid ? theme.colors.danger.main : _core.withPaletteNumber.call(void 0, colorScheme.main, 500)
|
|
72
|
+
},
|
|
73
|
+
unfocusedBorderColor: neutralBorder,
|
|
74
|
+
textColor,
|
|
75
|
+
placeholderColor,
|
|
76
|
+
labelColor,
|
|
77
|
+
helperColor
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (variant === "bordered") {
|
|
81
|
+
return {
|
|
82
|
+
container: {
|
|
83
|
+
backgroundColor: theme.colors.background,
|
|
84
|
+
borderColor: isInvalid ? theme.colors.danger.main : neutralBorder,
|
|
85
|
+
borderWidth: theme.borderWidth.md
|
|
86
|
+
},
|
|
87
|
+
unfocusedBorderColor: neutralBorder,
|
|
88
|
+
textColor,
|
|
89
|
+
placeholderColor,
|
|
90
|
+
labelColor,
|
|
91
|
+
helperColor
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
if (variant === "faded") {
|
|
95
|
+
return {
|
|
96
|
+
container: {
|
|
97
|
+
backgroundColor: _core.withOpacity.call(void 0, colorScheme.background, 0.68),
|
|
98
|
+
borderColor: isInvalid ? theme.colors.danger.main : "transparent",
|
|
99
|
+
borderWidth: isInvalid ? theme.borderWidth.md : 0
|
|
100
|
+
},
|
|
101
|
+
unfocusedBorderColor: "transparent",
|
|
102
|
+
textColor,
|
|
103
|
+
placeholderColor,
|
|
104
|
+
labelColor,
|
|
105
|
+
helperColor
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
container: {
|
|
110
|
+
backgroundColor: colorScheme.background,
|
|
111
|
+
borderColor: isInvalid ? _core.withPaletteNumber.call(void 0, theme.colors.danger.main, 500) : "transparent",
|
|
112
|
+
borderWidth: isInvalid ? theme.borderWidth.md : 0
|
|
113
|
+
},
|
|
114
|
+
unfocusedBorderColor: "transparent",
|
|
115
|
+
textColor,
|
|
116
|
+
placeholderColor,
|
|
117
|
+
labelColor,
|
|
118
|
+
helperColor
|
|
119
|
+
};
|
|
120
|
+
}, [colorScheme, isDisabled, isInvalid, theme, variant]);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// src/components/input-trigger/input-trigger.style.ts
|
|
124
|
+
|
|
125
|
+
var styles = _reactnative.StyleSheet.create({
|
|
126
|
+
container: {
|
|
127
|
+
width: "100%",
|
|
128
|
+
gap: 6
|
|
129
|
+
},
|
|
130
|
+
noFullWidth: {
|
|
131
|
+
alignSelf: "flex-start"
|
|
132
|
+
},
|
|
133
|
+
inputContainer: {
|
|
134
|
+
gap: 6
|
|
135
|
+
},
|
|
136
|
+
label: {
|
|
137
|
+
fontWeight: "500"
|
|
138
|
+
},
|
|
139
|
+
inputWrapper: {
|
|
140
|
+
flexDirection: "row",
|
|
141
|
+
alignItems: "center"
|
|
142
|
+
},
|
|
143
|
+
underlinedWrapper: {
|
|
144
|
+
borderBottomLeftRadius: 0,
|
|
145
|
+
borderBottomRightRadius: 0,
|
|
146
|
+
paddingHorizontal: 0
|
|
147
|
+
},
|
|
148
|
+
slot: {
|
|
149
|
+
justifyContent: "center",
|
|
150
|
+
alignItems: "center"
|
|
151
|
+
},
|
|
152
|
+
content: {
|
|
153
|
+
flex: 1,
|
|
154
|
+
padding: 0
|
|
155
|
+
},
|
|
156
|
+
helperText: {
|
|
157
|
+
fontWeight: "400"
|
|
158
|
+
},
|
|
159
|
+
disabled: {
|
|
160
|
+
opacity: 0.6
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// src/components/input-trigger/input-trigger.tsx
|
|
165
|
+
var InputTrigger = ({
|
|
166
|
+
value,
|
|
167
|
+
placeholder = "Select...",
|
|
168
|
+
label,
|
|
169
|
+
labelPlacement = "outside",
|
|
170
|
+
description,
|
|
171
|
+
errorMessage,
|
|
172
|
+
startContent,
|
|
173
|
+
endContent,
|
|
174
|
+
themeColor = "primary",
|
|
175
|
+
variant = "flat",
|
|
176
|
+
size = "md",
|
|
177
|
+
radius = "md",
|
|
178
|
+
isDisabled = false,
|
|
179
|
+
isInvalid = false,
|
|
180
|
+
fullWidth = true,
|
|
181
|
+
customAppearance,
|
|
182
|
+
onPress
|
|
183
|
+
}) => {
|
|
184
|
+
const sizeStyles = useInputTriggerSizeStyles(size);
|
|
185
|
+
const radiusStyles = useInputTriggerRadiusStyles(radius);
|
|
186
|
+
const variantStyles = useInputTriggerVariantStyles({
|
|
187
|
+
themeColor,
|
|
188
|
+
variant,
|
|
189
|
+
isInvalid,
|
|
190
|
+
isDisabled
|
|
191
|
+
});
|
|
192
|
+
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
193
|
+
const helperText = isInvalid && errorMessage ? errorMessage : description;
|
|
194
|
+
const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ _react2.default.createElement(
|
|
195
|
+
_reactnative.Text,
|
|
196
|
+
{
|
|
197
|
+
style: [
|
|
198
|
+
styles.label,
|
|
199
|
+
{
|
|
200
|
+
color: variantStyles.labelColor,
|
|
201
|
+
fontSize: sizeStyles.labelSize
|
|
202
|
+
},
|
|
203
|
+
_optionalChain([customAppearance, 'optionalAccess', _ => _.label])
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
label
|
|
207
|
+
) : /* @__PURE__ */ _react2.default.createElement(_reactnative.View, null, label) : null;
|
|
208
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
209
|
+
_reactnative.View,
|
|
210
|
+
{
|
|
211
|
+
style: [
|
|
212
|
+
styles.container,
|
|
213
|
+
!fullWidth && styles.noFullWidth,
|
|
214
|
+
isDisabled && styles.disabled,
|
|
215
|
+
_optionalChain([customAppearance, 'optionalAccess', _2 => _2.container])
|
|
216
|
+
]
|
|
217
|
+
},
|
|
218
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.inputContainer, _optionalChain([customAppearance, 'optionalAccess', _3 => _3.inputContainer])] }, label && labelPlacement === "outside" && renderLabel, /* @__PURE__ */ _react2.default.createElement(
|
|
219
|
+
_reactnative.Pressable,
|
|
220
|
+
{
|
|
221
|
+
onPress: isDisabled ? void 0 : onPress,
|
|
222
|
+
disabled: isDisabled,
|
|
223
|
+
accessibilityRole: "button"
|
|
224
|
+
},
|
|
225
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
226
|
+
_reactnative.View,
|
|
227
|
+
{
|
|
228
|
+
style: [
|
|
229
|
+
styles.inputWrapper,
|
|
230
|
+
{
|
|
231
|
+
minHeight: sizeStyles.minHeight,
|
|
232
|
+
paddingVertical: sizeStyles.paddingVertical,
|
|
233
|
+
paddingHorizontal: variant === "underlined" ? 0 : sizeStyles.paddingHorizontal,
|
|
234
|
+
gap: sizeStyles.slotGap,
|
|
235
|
+
backgroundColor: variantStyles.container.backgroundColor,
|
|
236
|
+
borderWidth: variant === "underlined" ? 0 : variantStyles.container.borderWidth,
|
|
237
|
+
...variant === "underlined" && {
|
|
238
|
+
borderBottomWidth: variantStyles.container.borderBottomWidth
|
|
239
|
+
},
|
|
240
|
+
borderRadius: variant === "underlined" ? 0 : radiusStyles.borderRadius,
|
|
241
|
+
borderColor: variant === "underlined" ? variantStyles.container.borderColor : variantStyles.container.borderColor
|
|
242
|
+
},
|
|
243
|
+
variant === "underlined" && styles.underlinedWrapper,
|
|
244
|
+
_optionalChain([customAppearance, 'optionalAccess', _4 => _4.inputWrapper])
|
|
245
|
+
]
|
|
246
|
+
},
|
|
247
|
+
startContent && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.slot }, startContent),
|
|
248
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
249
|
+
_reactnative.View,
|
|
250
|
+
{
|
|
251
|
+
style: {
|
|
252
|
+
flex: 1,
|
|
253
|
+
gap: labelPlacement === "inside" && label ? 2 : 0
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
label && labelPlacement === "inside" && renderLabel,
|
|
257
|
+
typeof value === "string" || typeof value === "number" ? /* @__PURE__ */ _react2.default.createElement(
|
|
258
|
+
_reactnative.Text,
|
|
259
|
+
{
|
|
260
|
+
numberOfLines: 1,
|
|
261
|
+
style: [
|
|
262
|
+
styles.content,
|
|
263
|
+
{
|
|
264
|
+
color: hasValue ? variantStyles.textColor : variantStyles.placeholderColor,
|
|
265
|
+
fontSize: sizeStyles.fontSize
|
|
266
|
+
},
|
|
267
|
+
_optionalChain([customAppearance, 'optionalAccess', _5 => _5.content])
|
|
268
|
+
]
|
|
269
|
+
},
|
|
270
|
+
hasValue ? value : placeholder
|
|
271
|
+
) : hasValue ? /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: { flex: 1 } }, value) : /* @__PURE__ */ _react2.default.createElement(
|
|
272
|
+
_reactnative.Text,
|
|
273
|
+
{
|
|
274
|
+
style: [
|
|
275
|
+
styles.content,
|
|
276
|
+
{
|
|
277
|
+
color: variantStyles.placeholderColor,
|
|
278
|
+
fontSize: sizeStyles.fontSize
|
|
279
|
+
},
|
|
280
|
+
_optionalChain([customAppearance, 'optionalAccess', _6 => _6.content])
|
|
281
|
+
]
|
|
282
|
+
},
|
|
283
|
+
placeholder
|
|
284
|
+
)
|
|
285
|
+
),
|
|
286
|
+
endContent && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.slot }, endContent)
|
|
287
|
+
)
|
|
288
|
+
)),
|
|
289
|
+
helperText ? typeof helperText === "string" || typeof helperText === "number" ? /* @__PURE__ */ _react2.default.createElement(
|
|
290
|
+
_reactnative.Text,
|
|
291
|
+
{
|
|
292
|
+
style: [
|
|
293
|
+
styles.helperText,
|
|
294
|
+
{
|
|
295
|
+
color: variantStyles.helperColor,
|
|
296
|
+
fontSize: sizeStyles.helperSize
|
|
297
|
+
},
|
|
298
|
+
_optionalChain([customAppearance, 'optionalAccess', _7 => _7.helperText])
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
helperText
|
|
302
|
+
) : /* @__PURE__ */ _react2.default.createElement(_reactnative.View, null, helperText) : null
|
|
303
|
+
);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
exports.InputTrigger = InputTrigger;
|
|
File without changes
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useXUITheme
|
|
3
|
+
} from "./chunk-LTKYHG5V.js";
|
|
4
|
+
|
|
5
|
+
// src/components/input-trigger/input-trigger.tsx
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { Pressable, Text, View } from "react-native";
|
|
8
|
+
|
|
9
|
+
// src/components/input-trigger/input-trigger.hook.ts
|
|
10
|
+
import { useMemo } from "react";
|
|
11
|
+
import { getSafeThemeColor, withOpacity, withPaletteNumber } from "@xaui/core";
|
|
12
|
+
var sizeMap = {
|
|
13
|
+
sm: {
|
|
14
|
+
minHeight: 40,
|
|
15
|
+
fontSize: 14,
|
|
16
|
+
paddingHorizontal: 12,
|
|
17
|
+
paddingVertical: 8,
|
|
18
|
+
slotGap: 8,
|
|
19
|
+
labelSize: 13,
|
|
20
|
+
helperSize: 12
|
|
21
|
+
},
|
|
22
|
+
md: {
|
|
23
|
+
minHeight: 46,
|
|
24
|
+
fontSize: 16,
|
|
25
|
+
paddingHorizontal: 14,
|
|
26
|
+
paddingVertical: 10,
|
|
27
|
+
slotGap: 10,
|
|
28
|
+
labelSize: 14,
|
|
29
|
+
helperSize: 13
|
|
30
|
+
},
|
|
31
|
+
lg: {
|
|
32
|
+
minHeight: 52,
|
|
33
|
+
fontSize: 17,
|
|
34
|
+
paddingHorizontal: 16,
|
|
35
|
+
paddingVertical: 12,
|
|
36
|
+
slotGap: 12,
|
|
37
|
+
labelSize: 15,
|
|
38
|
+
helperSize: 15
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var useInputTriggerSizeStyles = (size) => useMemo(() => sizeMap[size], [size]);
|
|
42
|
+
var useInputTriggerRadiusStyles = (radius) => {
|
|
43
|
+
const theme = useXUITheme();
|
|
44
|
+
return useMemo(() => {
|
|
45
|
+
if (radius === "full") {
|
|
46
|
+
return { borderRadius: theme.borderRadius.full };
|
|
47
|
+
}
|
|
48
|
+
return { borderRadius: theme.borderRadius[radius] };
|
|
49
|
+
}, [radius, theme.borderRadius]);
|
|
50
|
+
};
|
|
51
|
+
var useInputTriggerVariantStyles = ({
|
|
52
|
+
themeColor,
|
|
53
|
+
variant,
|
|
54
|
+
isInvalid,
|
|
55
|
+
isDisabled
|
|
56
|
+
}) => {
|
|
57
|
+
const theme = useXUITheme();
|
|
58
|
+
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
59
|
+
const colorScheme = theme.colors[safeThemeColor];
|
|
60
|
+
return useMemo(() => {
|
|
61
|
+
const neutralBorder = withOpacity(theme.colors.foreground, 0.1);
|
|
62
|
+
const textColor = isDisabled ? withOpacity(theme.colors.foreground, 0.55) : theme.colors.foreground;
|
|
63
|
+
const placeholderColor = withOpacity(theme.colors.foreground, 0.45);
|
|
64
|
+
const labelColor = isInvalid ? theme.colors.danger.main : withOpacity(theme.colors.foreground, 0.8);
|
|
65
|
+
const helperColor = isInvalid ? theme.colors.danger.main : withOpacity(theme.colors.foreground, 0.72);
|
|
66
|
+
if (variant === "underlined") {
|
|
67
|
+
return {
|
|
68
|
+
container: {
|
|
69
|
+
backgroundColor: "transparent",
|
|
70
|
+
borderBottomWidth: isInvalid ? 2 : 1,
|
|
71
|
+
borderColor: isInvalid ? theme.colors.danger.main : withPaletteNumber(colorScheme.main, 500)
|
|
72
|
+
},
|
|
73
|
+
unfocusedBorderColor: neutralBorder,
|
|
74
|
+
textColor,
|
|
75
|
+
placeholderColor,
|
|
76
|
+
labelColor,
|
|
77
|
+
helperColor
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (variant === "bordered") {
|
|
81
|
+
return {
|
|
82
|
+
container: {
|
|
83
|
+
backgroundColor: theme.colors.background,
|
|
84
|
+
borderColor: isInvalid ? theme.colors.danger.main : neutralBorder,
|
|
85
|
+
borderWidth: theme.borderWidth.md
|
|
86
|
+
},
|
|
87
|
+
unfocusedBorderColor: neutralBorder,
|
|
88
|
+
textColor,
|
|
89
|
+
placeholderColor,
|
|
90
|
+
labelColor,
|
|
91
|
+
helperColor
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
if (variant === "faded") {
|
|
95
|
+
return {
|
|
96
|
+
container: {
|
|
97
|
+
backgroundColor: withOpacity(colorScheme.background, 0.68),
|
|
98
|
+
borderColor: isInvalid ? theme.colors.danger.main : "transparent",
|
|
99
|
+
borderWidth: isInvalid ? theme.borderWidth.md : 0
|
|
100
|
+
},
|
|
101
|
+
unfocusedBorderColor: "transparent",
|
|
102
|
+
textColor,
|
|
103
|
+
placeholderColor,
|
|
104
|
+
labelColor,
|
|
105
|
+
helperColor
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
container: {
|
|
110
|
+
backgroundColor: colorScheme.background,
|
|
111
|
+
borderColor: isInvalid ? withPaletteNumber(theme.colors.danger.main, 500) : "transparent",
|
|
112
|
+
borderWidth: isInvalid ? theme.borderWidth.md : 0
|
|
113
|
+
},
|
|
114
|
+
unfocusedBorderColor: "transparent",
|
|
115
|
+
textColor,
|
|
116
|
+
placeholderColor,
|
|
117
|
+
labelColor,
|
|
118
|
+
helperColor
|
|
119
|
+
};
|
|
120
|
+
}, [colorScheme, isDisabled, isInvalid, theme, variant]);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// src/components/input-trigger/input-trigger.style.ts
|
|
124
|
+
import { StyleSheet } from "react-native";
|
|
125
|
+
var styles = StyleSheet.create({
|
|
126
|
+
container: {
|
|
127
|
+
width: "100%",
|
|
128
|
+
gap: 6
|
|
129
|
+
},
|
|
130
|
+
noFullWidth: {
|
|
131
|
+
alignSelf: "flex-start"
|
|
132
|
+
},
|
|
133
|
+
inputContainer: {
|
|
134
|
+
gap: 6
|
|
135
|
+
},
|
|
136
|
+
label: {
|
|
137
|
+
fontWeight: "500"
|
|
138
|
+
},
|
|
139
|
+
inputWrapper: {
|
|
140
|
+
flexDirection: "row",
|
|
141
|
+
alignItems: "center"
|
|
142
|
+
},
|
|
143
|
+
underlinedWrapper: {
|
|
144
|
+
borderBottomLeftRadius: 0,
|
|
145
|
+
borderBottomRightRadius: 0,
|
|
146
|
+
paddingHorizontal: 0
|
|
147
|
+
},
|
|
148
|
+
slot: {
|
|
149
|
+
justifyContent: "center",
|
|
150
|
+
alignItems: "center"
|
|
151
|
+
},
|
|
152
|
+
content: {
|
|
153
|
+
flex: 1,
|
|
154
|
+
padding: 0
|
|
155
|
+
},
|
|
156
|
+
helperText: {
|
|
157
|
+
fontWeight: "400"
|
|
158
|
+
},
|
|
159
|
+
disabled: {
|
|
160
|
+
opacity: 0.6
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// src/components/input-trigger/input-trigger.tsx
|
|
165
|
+
var InputTrigger = ({
|
|
166
|
+
value,
|
|
167
|
+
placeholder = "Select...",
|
|
168
|
+
label,
|
|
169
|
+
labelPlacement = "outside",
|
|
170
|
+
description,
|
|
171
|
+
errorMessage,
|
|
172
|
+
startContent,
|
|
173
|
+
endContent,
|
|
174
|
+
themeColor = "primary",
|
|
175
|
+
variant = "flat",
|
|
176
|
+
size = "md",
|
|
177
|
+
radius = "md",
|
|
178
|
+
isDisabled = false,
|
|
179
|
+
isInvalid = false,
|
|
180
|
+
fullWidth = true,
|
|
181
|
+
customAppearance,
|
|
182
|
+
onPress
|
|
183
|
+
}) => {
|
|
184
|
+
const sizeStyles = useInputTriggerSizeStyles(size);
|
|
185
|
+
const radiusStyles = useInputTriggerRadiusStyles(radius);
|
|
186
|
+
const variantStyles = useInputTriggerVariantStyles({
|
|
187
|
+
themeColor,
|
|
188
|
+
variant,
|
|
189
|
+
isInvalid,
|
|
190
|
+
isDisabled
|
|
191
|
+
});
|
|
192
|
+
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
193
|
+
const helperText = isInvalid && errorMessage ? errorMessage : description;
|
|
194
|
+
const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ React.createElement(
|
|
195
|
+
Text,
|
|
196
|
+
{
|
|
197
|
+
style: [
|
|
198
|
+
styles.label,
|
|
199
|
+
{
|
|
200
|
+
color: variantStyles.labelColor,
|
|
201
|
+
fontSize: sizeStyles.labelSize
|
|
202
|
+
},
|
|
203
|
+
customAppearance?.label
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
label
|
|
207
|
+
) : /* @__PURE__ */ React.createElement(View, null, label) : null;
|
|
208
|
+
return /* @__PURE__ */ React.createElement(
|
|
209
|
+
View,
|
|
210
|
+
{
|
|
211
|
+
style: [
|
|
212
|
+
styles.container,
|
|
213
|
+
!fullWidth && styles.noFullWidth,
|
|
214
|
+
isDisabled && styles.disabled,
|
|
215
|
+
customAppearance?.container
|
|
216
|
+
]
|
|
217
|
+
},
|
|
218
|
+
/* @__PURE__ */ React.createElement(View, { style: [styles.inputContainer, customAppearance?.inputContainer] }, label && labelPlacement === "outside" && renderLabel, /* @__PURE__ */ React.createElement(
|
|
219
|
+
Pressable,
|
|
220
|
+
{
|
|
221
|
+
onPress: isDisabled ? void 0 : onPress,
|
|
222
|
+
disabled: isDisabled,
|
|
223
|
+
accessibilityRole: "button"
|
|
224
|
+
},
|
|
225
|
+
/* @__PURE__ */ React.createElement(
|
|
226
|
+
View,
|
|
227
|
+
{
|
|
228
|
+
style: [
|
|
229
|
+
styles.inputWrapper,
|
|
230
|
+
{
|
|
231
|
+
minHeight: sizeStyles.minHeight,
|
|
232
|
+
paddingVertical: sizeStyles.paddingVertical,
|
|
233
|
+
paddingHorizontal: variant === "underlined" ? 0 : sizeStyles.paddingHorizontal,
|
|
234
|
+
gap: sizeStyles.slotGap,
|
|
235
|
+
backgroundColor: variantStyles.container.backgroundColor,
|
|
236
|
+
borderWidth: variant === "underlined" ? 0 : variantStyles.container.borderWidth,
|
|
237
|
+
...variant === "underlined" && {
|
|
238
|
+
borderBottomWidth: variantStyles.container.borderBottomWidth
|
|
239
|
+
},
|
|
240
|
+
borderRadius: variant === "underlined" ? 0 : radiusStyles.borderRadius,
|
|
241
|
+
borderColor: variant === "underlined" ? variantStyles.container.borderColor : variantStyles.container.borderColor
|
|
242
|
+
},
|
|
243
|
+
variant === "underlined" && styles.underlinedWrapper,
|
|
244
|
+
customAppearance?.inputWrapper
|
|
245
|
+
]
|
|
246
|
+
},
|
|
247
|
+
startContent && /* @__PURE__ */ React.createElement(View, { style: styles.slot }, startContent),
|
|
248
|
+
/* @__PURE__ */ React.createElement(
|
|
249
|
+
View,
|
|
250
|
+
{
|
|
251
|
+
style: {
|
|
252
|
+
flex: 1,
|
|
253
|
+
gap: labelPlacement === "inside" && label ? 2 : 0
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
label && labelPlacement === "inside" && renderLabel,
|
|
257
|
+
typeof value === "string" || typeof value === "number" ? /* @__PURE__ */ React.createElement(
|
|
258
|
+
Text,
|
|
259
|
+
{
|
|
260
|
+
numberOfLines: 1,
|
|
261
|
+
style: [
|
|
262
|
+
styles.content,
|
|
263
|
+
{
|
|
264
|
+
color: hasValue ? variantStyles.textColor : variantStyles.placeholderColor,
|
|
265
|
+
fontSize: sizeStyles.fontSize
|
|
266
|
+
},
|
|
267
|
+
customAppearance?.content
|
|
268
|
+
]
|
|
269
|
+
},
|
|
270
|
+
hasValue ? value : placeholder
|
|
271
|
+
) : hasValue ? /* @__PURE__ */ React.createElement(View, { style: { flex: 1 } }, value) : /* @__PURE__ */ React.createElement(
|
|
272
|
+
Text,
|
|
273
|
+
{
|
|
274
|
+
style: [
|
|
275
|
+
styles.content,
|
|
276
|
+
{
|
|
277
|
+
color: variantStyles.placeholderColor,
|
|
278
|
+
fontSize: sizeStyles.fontSize
|
|
279
|
+
},
|
|
280
|
+
customAppearance?.content
|
|
281
|
+
]
|
|
282
|
+
},
|
|
283
|
+
placeholder
|
|
284
|
+
)
|
|
285
|
+
),
|
|
286
|
+
endContent && /* @__PURE__ */ React.createElement(View, { style: styles.slot }, endContent)
|
|
287
|
+
)
|
|
288
|
+
)),
|
|
289
|
+
helperText ? typeof helperText === "string" || typeof helperText === "number" ? /* @__PURE__ */ React.createElement(
|
|
290
|
+
Text,
|
|
291
|
+
{
|
|
292
|
+
style: [
|
|
293
|
+
styles.helperText,
|
|
294
|
+
{
|
|
295
|
+
color: variantStyles.helperColor,
|
|
296
|
+
fontSize: sizeStyles.helperSize
|
|
297
|
+
},
|
|
298
|
+
customAppearance?.helperText
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
helperText
|
|
302
|
+
) : /* @__PURE__ */ React.createElement(View, null, helperText) : null
|
|
303
|
+
);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
export {
|
|
307
|
+
InputTrigger
|
|
308
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|