@xaui/native 0.1.4 → 0.2.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.
- package/README.md +109 -113
- package/dist/alert/index.cjs +6 -9
- package/dist/alert/index.js +4 -7
- package/dist/app-bar/index.cjs +4 -4
- package/dist/app-bar/index.js +2 -2
- package/dist/autocomplete/index.cjs +20 -25
- package/dist/autocomplete/index.d.cts +1 -1
- package/dist/autocomplete/index.d.ts +1 -1
- package/dist/autocomplete/index.js +11 -16
- package/dist/avatar/index.cjs +9 -9
- package/dist/avatar/index.js +5 -5
- package/dist/badge/index.cjs +13 -14
- package/dist/badge/index.js +10 -11
- package/dist/bottom-sheet/index.cjs +3 -3
- package/dist/bottom-sheet/index.js +2 -2
- package/dist/bottom-tab-bar/index.cjs +2 -2
- package/dist/bottom-tab-bar/index.js +1 -1
- package/dist/button/index.cjs +19 -22
- package/dist/button/index.d.cts +3 -3
- package/dist/button/index.d.ts +3 -3
- package/dist/button/index.js +12 -15
- package/dist/card/index.cjs +8 -8
- package/dist/card/index.js +3 -3
- package/dist/carousel/index.cjs +2 -2
- package/dist/carousel/index.js +1 -1
- package/dist/checkbox/index.cjs +11 -11
- package/dist/checkbox/index.js +6 -6
- package/dist/chip/index.cjs +11 -11
- package/dist/chip/index.js +9 -9
- package/dist/{chunk-K24VDBNN.js → chunk-4JFWQ5XT.js} +2 -2
- package/dist/{chunk-RZJFCDFS.cjs → chunk-7UFBLUMV.cjs} +13 -19
- package/dist/{chunk-M6A23KUM.js → chunk-A45TVXU5.js} +29 -5
- package/dist/{chunk-3XWF77Y3.cjs → chunk-BYWUAPC4.cjs} +4 -4
- package/dist/{chunk-X5KNZ6YJ.cjs → chunk-DJ4Q37UT.cjs} +2 -2
- package/dist/{chunk-LVNBYERF.js → chunk-RBSA4NH4.js} +13 -19
- package/dist/{chunk-HYL4EU3Y.cjs → chunk-UGEINZM7.cjs} +14 -13
- package/dist/{chunk-WGWXGIZ3.js → chunk-UU4HHBDN.js} +10 -9
- package/dist/{chunk-J3BOFXIH.js → chunk-VSZEXOUN.js} +4 -4
- package/dist/{chunk-FBTBWI3P.cjs → chunk-YIEUN3G5.cjs} +7 -7
- package/dist/{chunk-43I45LX7.cjs → chunk-ZH6ZSV2Q.cjs} +33 -9
- package/dist/{chunk-2JKWVIPB.js → chunk-ZY7IUTAT.js} +1 -1
- package/dist/color-picker/index.cjs +7 -7
- package/dist/color-picker/index.d.cts +1 -1
- package/dist/color-picker/index.d.ts +1 -1
- package/dist/color-picker/index.js +4 -4
- package/dist/core/index.cjs +2 -2
- package/dist/core/index.d.cts +1 -2
- package/dist/core/index.d.ts +1 -2
- package/dist/core/index.js +1 -1
- package/dist/datepicker/index.cjs +28 -30
- package/dist/datepicker/index.d.cts +1 -1
- package/dist/datepicker/index.d.ts +1 -1
- package/dist/datepicker/index.js +17 -19
- package/dist/dialog/index.cjs +5 -5
- package/dist/dialog/index.js +1 -1
- package/dist/divider/index.cjs +3 -3
- package/dist/divider/index.js +2 -2
- package/dist/drawer/index.cjs +4 -4
- package/dist/drawer/index.js +3 -3
- package/dist/expansion-panel/index.cjs +12 -12
- package/dist/expansion-panel/index.js +3 -3
- package/dist/fab/index.cjs +4 -4
- package/dist/fab/index.js +3 -3
- package/dist/fab-menu/index.cjs +8 -8
- package/dist/fab-menu/index.js +4 -4
- package/dist/feature-discovery/index.cjs +6 -6
- package/dist/feature-discovery/index.js +5 -5
- package/dist/indicator/index.cjs +3 -3
- package/dist/indicator/index.js +2 -2
- package/dist/input/index.cjs +38 -20
- package/dist/input/index.d.cts +2 -2
- package/dist/input/index.d.ts +2 -2
- package/dist/input/index.js +36 -18
- package/dist/input-trigger/index.cjs +193 -4
- package/dist/input-trigger/index.d.cts +5 -3
- package/dist/input-trigger/index.d.ts +5 -3
- package/dist/input-trigger/index.js +192 -3
- package/dist/{input-trigger.type-BL70fHE9.d.cts → input-trigger.type-By_1ZjKd.d.cts} +86 -3
- package/dist/{input-trigger.type-BODYStHk.d.ts → input-trigger.type-DlSqg2eG.d.ts} +86 -3
- package/dist/list/index.cjs +6 -6
- package/dist/list/index.js +2 -2
- package/dist/menu/index.cjs +4 -4
- package/dist/menu/index.js +2 -2
- package/dist/menubox/index.cjs +7 -7
- package/dist/menubox/index.d.cts +1 -1
- package/dist/menubox/index.d.ts +1 -1
- package/dist/menubox/index.js +3 -3
- package/dist/picker/index.cjs +7 -7
- package/dist/picker/index.d.cts +1 -1
- package/dist/picker/index.d.ts +1 -1
- package/dist/picker/index.js +4 -4
- package/dist/progress/index.cjs +3 -3
- package/dist/progress/index.js +2 -2
- package/dist/radio/index.cjs +9 -9
- package/dist/radio/index.js +3 -3
- package/dist/refresh-control/index.cjs +45 -0
- package/dist/refresh-control/index.d.cts +55 -0
- package/dist/refresh-control/index.d.ts +55 -0
- package/dist/refresh-control/index.js +45 -0
- package/dist/segment-button/index.cjs +8 -8
- package/dist/segment-button/index.js +5 -5
- package/dist/select/index.cjs +50 -58
- package/dist/select/index.d.cts +2 -2
- package/dist/select/index.d.ts +2 -2
- package/dist/select/index.js +37 -45
- package/dist/skeleton/index.cjs +4 -4
- package/dist/skeleton/index.js +3 -3
- package/dist/slider/index.cjs +5 -5
- package/dist/slider/index.js +1 -1
- package/dist/snackbar/index.cjs +6 -6
- package/dist/snackbar/index.js +4 -4
- package/dist/snippet/index.cjs +4 -4
- package/dist/snippet/index.js +2 -2
- package/dist/stepper/index.cjs +3 -3
- package/dist/stepper/index.js +2 -2
- package/dist/switch/index.cjs +8 -8
- package/dist/switch/index.js +2 -2
- package/dist/tabs/index.cjs +7 -7
- package/dist/tabs/index.js +4 -4
- package/dist/timepicker/index.cjs +7 -7
- package/dist/timepicker/index.js +4 -4
- package/dist/toolbar/index.cjs +3 -3
- package/dist/toolbar/index.js +2 -2
- package/dist/typography/index.cjs +5 -3
- package/dist/typography/index.d.cts +4 -0
- package/dist/typography/index.d.ts +4 -0
- package/dist/typography/index.js +3 -1
- package/dist/view/index.cjs +4 -4
- package/dist/view/index.js +2 -2
- package/package.json +8 -3
|
@@ -1,8 +1,197 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
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
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkZH6ZSV2Qcjs = require('../chunk-ZH6ZSV2Q.cjs');
|
|
4
8
|
require('../chunk-56RPWZD2.cjs');
|
|
5
|
-
require('../chunk-RZJFCDFS.cjs');
|
|
6
9
|
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
|
|
12
|
+
|
|
13
|
+
// src/components/input-trigger/file-input-trigger.tsx
|
|
14
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
15
|
+
var _core = require('@xaui/core');
|
|
16
|
+
var _reactnative = require('react-native');
|
|
17
|
+
|
|
18
|
+
// src/components/input-trigger/file-input-plus-icon.tsx
|
|
19
|
+
|
|
20
|
+
var _reactnativesvg = require('react-native-svg'); var _reactnativesvg2 = _interopRequireDefault(_reactnativesvg);
|
|
21
|
+
var FileInputPlusIcon = ({
|
|
22
|
+
size = 16,
|
|
23
|
+
color = "#111827"
|
|
24
|
+
}) => {
|
|
25
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnativesvg2.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ _react2.default.createElement(
|
|
26
|
+
_reactnativesvg.Path,
|
|
27
|
+
{
|
|
28
|
+
d: "M12 5v14M5 12h14",
|
|
29
|
+
stroke: color,
|
|
30
|
+
strokeWidth: 2,
|
|
31
|
+
strokeLinecap: "round"
|
|
32
|
+
}
|
|
33
|
+
));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// src/components/input-trigger/file-input-trigger.tsx
|
|
37
|
+
var iconContainerSizeMap = {
|
|
38
|
+
sm: 28,
|
|
39
|
+
md: 32,
|
|
40
|
+
lg: 36
|
|
41
|
+
};
|
|
42
|
+
var dropzoneMinHeightMap = {
|
|
43
|
+
sm: 88,
|
|
44
|
+
md: 104,
|
|
45
|
+
lg: 120
|
|
46
|
+
};
|
|
47
|
+
var FileInputTrigger = ({
|
|
48
|
+
value,
|
|
49
|
+
placeholder = "Select files",
|
|
50
|
+
label,
|
|
51
|
+
labelPlacement = "outside",
|
|
52
|
+
description,
|
|
53
|
+
errorMessage,
|
|
54
|
+
themeColor = "primary",
|
|
55
|
+
variant = "colored",
|
|
56
|
+
size = "md",
|
|
57
|
+
radius = "md",
|
|
58
|
+
isDisabled = false,
|
|
59
|
+
isInvalid = false,
|
|
60
|
+
fullWidth = false,
|
|
61
|
+
centerContent,
|
|
62
|
+
selectedContent,
|
|
63
|
+
customAppearance,
|
|
64
|
+
onPress
|
|
65
|
+
}) => {
|
|
66
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
67
|
+
const sizeStyles = _chunkZH6ZSV2Qcjs.useInputTriggerSizeStyles.call(void 0, size);
|
|
68
|
+
const radiusStyles = _chunkZH6ZSV2Qcjs.useInputTriggerRadiusStyles.call(void 0, radius);
|
|
69
|
+
const variantStyles = _chunkZH6ZSV2Qcjs.useInputTriggerVariantStyles.call(void 0, {
|
|
70
|
+
themeColor,
|
|
71
|
+
variant,
|
|
72
|
+
isInvalid,
|
|
73
|
+
isDisabled
|
|
74
|
+
});
|
|
75
|
+
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
76
|
+
const colorScheme = theme.colors[safeThemeColor];
|
|
77
|
+
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
78
|
+
const hasSelectedContent = selectedContent !== void 0 && selectedContent !== null;
|
|
79
|
+
const helperText = isInvalid && errorMessage ? errorMessage : description;
|
|
80
|
+
const iconContainerSize = iconContainerSizeMap[size];
|
|
81
|
+
const dropzoneMinHeight = dropzoneMinHeightMap[size];
|
|
82
|
+
const borderColor = _nullishCoalesce(variantStyles.container.borderColor, () => ( _core.withOpacity.call(void 0, theme.colors.foreground, 0.24)));
|
|
83
|
+
const borderWidth = _nullishCoalesce(_nullishCoalesce(variantStyles.container.borderWidth, () => ( variantStyles.container.borderBottomWidth)), () => ( theme.borderWidth.md));
|
|
84
|
+
const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ _react2.default.createElement(
|
|
85
|
+
_reactnative.Text,
|
|
86
|
+
{
|
|
87
|
+
style: [
|
|
88
|
+
_chunkZH6ZSV2Qcjs.styles.label,
|
|
89
|
+
{
|
|
90
|
+
color: variantStyles.labelColor,
|
|
91
|
+
fontSize: sizeStyles.labelSize
|
|
92
|
+
},
|
|
93
|
+
_optionalChain([customAppearance, 'optionalAccess', _ => _.label])
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
label
|
|
97
|
+
) : /* @__PURE__ */ _react2.default.createElement(_reactnative.View, null, label) : null;
|
|
98
|
+
const resolvedContent = centerContent ? centerContent : hasValue ? value : placeholder;
|
|
99
|
+
const shapeStyles = {
|
|
100
|
+
minHeight: dropzoneMinHeight,
|
|
101
|
+
borderRadius: variant === "underlined" ? 0 : radiusStyles.borderRadius
|
|
102
|
+
};
|
|
103
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
104
|
+
_reactnative.View,
|
|
105
|
+
{
|
|
106
|
+
style: [
|
|
107
|
+
_chunkZH6ZSV2Qcjs.styles.container,
|
|
108
|
+
!fullWidth && _chunkZH6ZSV2Qcjs.styles.noFullWidth,
|
|
109
|
+
isDisabled && _chunkZH6ZSV2Qcjs.styles.disabled,
|
|
110
|
+
_optionalChain([customAppearance, 'optionalAccess', _2 => _2.container])
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [_chunkZH6ZSV2Qcjs.styles.inputContainer, _optionalChain([customAppearance, 'optionalAccess', _3 => _3.inputContainer])] }, label && labelPlacement === "outside" && renderLabel, /* @__PURE__ */ _react2.default.createElement(
|
|
114
|
+
_reactnative.Pressable,
|
|
115
|
+
{
|
|
116
|
+
onPress: isDisabled ? void 0 : onPress,
|
|
117
|
+
disabled: isDisabled,
|
|
118
|
+
accessibilityRole: "button"
|
|
119
|
+
},
|
|
120
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
121
|
+
_reactnative.View,
|
|
122
|
+
{
|
|
123
|
+
style: [
|
|
124
|
+
_chunkZH6ZSV2Qcjs.styles.fileTrigger,
|
|
125
|
+
{
|
|
126
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
127
|
+
paddingVertical: sizeStyles.paddingVertical,
|
|
128
|
+
gap: sizeStyles.slotGap,
|
|
129
|
+
backgroundColor: variantStyles.container.backgroundColor,
|
|
130
|
+
borderStyle: "dashed",
|
|
131
|
+
borderColor,
|
|
132
|
+
borderWidth
|
|
133
|
+
},
|
|
134
|
+
shapeStyles,
|
|
135
|
+
variant === "underlined" && _chunkZH6ZSV2Qcjs.styles.underlinedWrapper,
|
|
136
|
+
_optionalChain([customAppearance, 'optionalAccess', _4 => _4.inputWrapper])
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
label && labelPlacement === "inside" && renderLabel,
|
|
140
|
+
hasSelectedContent ? /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: _chunkZH6ZSV2Qcjs.styles.fileSelectedContent }, selectedContent) : /* @__PURE__ */ _react2.default.createElement(_react2.default.Fragment, null, /* @__PURE__ */ _react2.default.createElement(
|
|
141
|
+
_reactnative.View,
|
|
142
|
+
{
|
|
143
|
+
style: [
|
|
144
|
+
_chunkZH6ZSV2Qcjs.styles.filePlusButton,
|
|
145
|
+
{
|
|
146
|
+
width: iconContainerSize,
|
|
147
|
+
height: iconContainerSize,
|
|
148
|
+
borderRadius: iconContainerSize / 2,
|
|
149
|
+
backgroundColor: _core.withOpacity.call(void 0, colorScheme.main, 0.14)
|
|
150
|
+
},
|
|
151
|
+
_optionalChain([customAppearance, 'optionalAccess', _5 => _5.plusButton])
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
155
|
+
FileInputPlusIcon,
|
|
156
|
+
{
|
|
157
|
+
size: Math.round(iconContainerSize * 0.5),
|
|
158
|
+
color: colorScheme.main
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
), typeof resolvedContent === "string" || typeof resolvedContent === "number" ? /* @__PURE__ */ _react2.default.createElement(
|
|
162
|
+
_reactnative.Text,
|
|
163
|
+
{
|
|
164
|
+
numberOfLines: 2,
|
|
165
|
+
style: [
|
|
166
|
+
_chunkZH6ZSV2Qcjs.styles.fileContent,
|
|
167
|
+
{
|
|
168
|
+
color: hasValue ? variantStyles.textColor : variantStyles.placeholderColor,
|
|
169
|
+
fontSize: sizeStyles.fontSize
|
|
170
|
+
},
|
|
171
|
+
_optionalChain([customAppearance, 'optionalAccess', _6 => _6.content])
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
resolvedContent
|
|
175
|
+
) : /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: _chunkZH6ZSV2Qcjs.styles.fileCustomContent }, resolvedContent))
|
|
176
|
+
)
|
|
177
|
+
)),
|
|
178
|
+
helperText ? typeof helperText === "string" || typeof helperText === "number" ? /* @__PURE__ */ _react2.default.createElement(
|
|
179
|
+
_reactnative.Text,
|
|
180
|
+
{
|
|
181
|
+
style: [
|
|
182
|
+
_chunkZH6ZSV2Qcjs.styles.helperText,
|
|
183
|
+
{
|
|
184
|
+
color: variantStyles.helperColor,
|
|
185
|
+
fontSize: sizeStyles.helperSize
|
|
186
|
+
},
|
|
187
|
+
_optionalChain([customAppearance, 'optionalAccess', _7 => _7.helperText])
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
helperText
|
|
191
|
+
) : /* @__PURE__ */ _react2.default.createElement(_reactnative.View, null, helperText) : null
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
exports.FileInputTrigger = FileInputTrigger; exports.InputTrigger = _chunkZH6ZSV2Qcjs.InputTrigger;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { I as InputTriggerProps } from '../input-trigger.type-
|
|
3
|
-
export { e as InputTriggerCustomAppearance, a as InputTriggerEvents, d as InputTriggerLabelPlacement, c as InputTriggerSize, b as InputTriggerVariant } from '../input-trigger.type-
|
|
2
|
+
import { I as InputTriggerProps, F as FileInputTriggerProps } from '../input-trigger.type-By_1ZjKd.cjs';
|
|
3
|
+
export { f as FileInputTriggerCustomAppearance, e as InputTriggerCustomAppearance, a as InputTriggerEvents, d as InputTriggerLabelPlacement, c as InputTriggerSize, b as InputTriggerVariant } from '../input-trigger.type-By_1ZjKd.cjs';
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '../index-DyU3sW3_.cjs';
|
|
6
6
|
|
|
7
7
|
declare const InputTrigger: React.FC<InputTriggerProps>;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
declare const FileInputTrigger: React.FC<FileInputTriggerProps>;
|
|
10
|
+
|
|
11
|
+
export { FileInputTrigger, FileInputTriggerProps, InputTrigger, InputTriggerProps };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { I as InputTriggerProps } from '../input-trigger.type-
|
|
3
|
-
export { e as InputTriggerCustomAppearance, a as InputTriggerEvents, d as InputTriggerLabelPlacement, c as InputTriggerSize, b as InputTriggerVariant } from '../input-trigger.type-
|
|
2
|
+
import { I as InputTriggerProps, F as FileInputTriggerProps } from '../input-trigger.type-DlSqg2eG.js';
|
|
3
|
+
export { f as FileInputTriggerCustomAppearance, e as InputTriggerCustomAppearance, a as InputTriggerEvents, d as InputTriggerLabelPlacement, c as InputTriggerSize, b as InputTriggerVariant } from '../input-trigger.type-DlSqg2eG.js';
|
|
4
4
|
import 'react-native';
|
|
5
5
|
import '../index-DyU3sW3_.js';
|
|
6
6
|
|
|
7
7
|
declare const InputTrigger: React.FC<InputTriggerProps>;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
declare const FileInputTrigger: React.FC<FileInputTriggerProps>;
|
|
10
|
+
|
|
11
|
+
export { FileInputTrigger, FileInputTriggerProps, InputTrigger, InputTriggerProps };
|
|
@@ -1,8 +1,197 @@
|
|
|
1
1
|
import {
|
|
2
|
-
InputTrigger
|
|
3
|
-
|
|
2
|
+
InputTrigger,
|
|
3
|
+
styles,
|
|
4
|
+
useInputTriggerRadiusStyles,
|
|
5
|
+
useInputTriggerSizeStyles,
|
|
6
|
+
useInputTriggerVariantStyles
|
|
7
|
+
} from "../chunk-A45TVXU5.js";
|
|
4
8
|
import "../chunk-SHBDANQN.js";
|
|
5
|
-
import
|
|
9
|
+
import {
|
|
10
|
+
useXUITheme
|
|
11
|
+
} from "../chunk-RBSA4NH4.js";
|
|
12
|
+
|
|
13
|
+
// src/components/input-trigger/file-input-trigger.tsx
|
|
14
|
+
import React2 from "react";
|
|
15
|
+
import { getSafeThemeColor, withOpacity } from "@xaui/core";
|
|
16
|
+
import { Pressable, Text, View } from "react-native";
|
|
17
|
+
|
|
18
|
+
// src/components/input-trigger/file-input-plus-icon.tsx
|
|
19
|
+
import React from "react";
|
|
20
|
+
import Svg, { Path } from "react-native-svg";
|
|
21
|
+
var FileInputPlusIcon = ({
|
|
22
|
+
size = 16,
|
|
23
|
+
color = "#111827"
|
|
24
|
+
}) => {
|
|
25
|
+
return /* @__PURE__ */ React.createElement(Svg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React.createElement(
|
|
26
|
+
Path,
|
|
27
|
+
{
|
|
28
|
+
d: "M12 5v14M5 12h14",
|
|
29
|
+
stroke: color,
|
|
30
|
+
strokeWidth: 2,
|
|
31
|
+
strokeLinecap: "round"
|
|
32
|
+
}
|
|
33
|
+
));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// src/components/input-trigger/file-input-trigger.tsx
|
|
37
|
+
var iconContainerSizeMap = {
|
|
38
|
+
sm: 28,
|
|
39
|
+
md: 32,
|
|
40
|
+
lg: 36
|
|
41
|
+
};
|
|
42
|
+
var dropzoneMinHeightMap = {
|
|
43
|
+
sm: 88,
|
|
44
|
+
md: 104,
|
|
45
|
+
lg: 120
|
|
46
|
+
};
|
|
47
|
+
var FileInputTrigger = ({
|
|
48
|
+
value,
|
|
49
|
+
placeholder = "Select files",
|
|
50
|
+
label,
|
|
51
|
+
labelPlacement = "outside",
|
|
52
|
+
description,
|
|
53
|
+
errorMessage,
|
|
54
|
+
themeColor = "primary",
|
|
55
|
+
variant = "colored",
|
|
56
|
+
size = "md",
|
|
57
|
+
radius = "md",
|
|
58
|
+
isDisabled = false,
|
|
59
|
+
isInvalid = false,
|
|
60
|
+
fullWidth = false,
|
|
61
|
+
centerContent,
|
|
62
|
+
selectedContent,
|
|
63
|
+
customAppearance,
|
|
64
|
+
onPress
|
|
65
|
+
}) => {
|
|
66
|
+
const theme = useXUITheme();
|
|
67
|
+
const sizeStyles = useInputTriggerSizeStyles(size);
|
|
68
|
+
const radiusStyles = useInputTriggerRadiusStyles(radius);
|
|
69
|
+
const variantStyles = useInputTriggerVariantStyles({
|
|
70
|
+
themeColor,
|
|
71
|
+
variant,
|
|
72
|
+
isInvalid,
|
|
73
|
+
isDisabled
|
|
74
|
+
});
|
|
75
|
+
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
76
|
+
const colorScheme = theme.colors[safeThemeColor];
|
|
77
|
+
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
78
|
+
const hasSelectedContent = selectedContent !== void 0 && selectedContent !== null;
|
|
79
|
+
const helperText = isInvalid && errorMessage ? errorMessage : description;
|
|
80
|
+
const iconContainerSize = iconContainerSizeMap[size];
|
|
81
|
+
const dropzoneMinHeight = dropzoneMinHeightMap[size];
|
|
82
|
+
const borderColor = variantStyles.container.borderColor ?? withOpacity(theme.colors.foreground, 0.24);
|
|
83
|
+
const borderWidth = variantStyles.container.borderWidth ?? variantStyles.container.borderBottomWidth ?? theme.borderWidth.md;
|
|
84
|
+
const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ React2.createElement(
|
|
85
|
+
Text,
|
|
86
|
+
{
|
|
87
|
+
style: [
|
|
88
|
+
styles.label,
|
|
89
|
+
{
|
|
90
|
+
color: variantStyles.labelColor,
|
|
91
|
+
fontSize: sizeStyles.labelSize
|
|
92
|
+
},
|
|
93
|
+
customAppearance?.label
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
label
|
|
97
|
+
) : /* @__PURE__ */ React2.createElement(View, null, label) : null;
|
|
98
|
+
const resolvedContent = centerContent ? centerContent : hasValue ? value : placeholder;
|
|
99
|
+
const shapeStyles = {
|
|
100
|
+
minHeight: dropzoneMinHeight,
|
|
101
|
+
borderRadius: variant === "underlined" ? 0 : radiusStyles.borderRadius
|
|
102
|
+
};
|
|
103
|
+
return /* @__PURE__ */ React2.createElement(
|
|
104
|
+
View,
|
|
105
|
+
{
|
|
106
|
+
style: [
|
|
107
|
+
styles.container,
|
|
108
|
+
!fullWidth && styles.noFullWidth,
|
|
109
|
+
isDisabled && styles.disabled,
|
|
110
|
+
customAppearance?.container
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
/* @__PURE__ */ React2.createElement(View, { style: [styles.inputContainer, customAppearance?.inputContainer] }, label && labelPlacement === "outside" && renderLabel, /* @__PURE__ */ React2.createElement(
|
|
114
|
+
Pressable,
|
|
115
|
+
{
|
|
116
|
+
onPress: isDisabled ? void 0 : onPress,
|
|
117
|
+
disabled: isDisabled,
|
|
118
|
+
accessibilityRole: "button"
|
|
119
|
+
},
|
|
120
|
+
/* @__PURE__ */ React2.createElement(
|
|
121
|
+
View,
|
|
122
|
+
{
|
|
123
|
+
style: [
|
|
124
|
+
styles.fileTrigger,
|
|
125
|
+
{
|
|
126
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
127
|
+
paddingVertical: sizeStyles.paddingVertical,
|
|
128
|
+
gap: sizeStyles.slotGap,
|
|
129
|
+
backgroundColor: variantStyles.container.backgroundColor,
|
|
130
|
+
borderStyle: "dashed",
|
|
131
|
+
borderColor,
|
|
132
|
+
borderWidth
|
|
133
|
+
},
|
|
134
|
+
shapeStyles,
|
|
135
|
+
variant === "underlined" && styles.underlinedWrapper,
|
|
136
|
+
customAppearance?.inputWrapper
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
label && labelPlacement === "inside" && renderLabel,
|
|
140
|
+
hasSelectedContent ? /* @__PURE__ */ React2.createElement(View, { style: styles.fileSelectedContent }, selectedContent) : /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
|
141
|
+
View,
|
|
142
|
+
{
|
|
143
|
+
style: [
|
|
144
|
+
styles.filePlusButton,
|
|
145
|
+
{
|
|
146
|
+
width: iconContainerSize,
|
|
147
|
+
height: iconContainerSize,
|
|
148
|
+
borderRadius: iconContainerSize / 2,
|
|
149
|
+
backgroundColor: withOpacity(colorScheme.main, 0.14)
|
|
150
|
+
},
|
|
151
|
+
customAppearance?.plusButton
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
/* @__PURE__ */ React2.createElement(
|
|
155
|
+
FileInputPlusIcon,
|
|
156
|
+
{
|
|
157
|
+
size: Math.round(iconContainerSize * 0.5),
|
|
158
|
+
color: colorScheme.main
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
), typeof resolvedContent === "string" || typeof resolvedContent === "number" ? /* @__PURE__ */ React2.createElement(
|
|
162
|
+
Text,
|
|
163
|
+
{
|
|
164
|
+
numberOfLines: 2,
|
|
165
|
+
style: [
|
|
166
|
+
styles.fileContent,
|
|
167
|
+
{
|
|
168
|
+
color: hasValue ? variantStyles.textColor : variantStyles.placeholderColor,
|
|
169
|
+
fontSize: sizeStyles.fontSize
|
|
170
|
+
},
|
|
171
|
+
customAppearance?.content
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
resolvedContent
|
|
175
|
+
) : /* @__PURE__ */ React2.createElement(View, { style: styles.fileCustomContent }, resolvedContent))
|
|
176
|
+
)
|
|
177
|
+
)),
|
|
178
|
+
helperText ? typeof helperText === "string" || typeof helperText === "number" ? /* @__PURE__ */ React2.createElement(
|
|
179
|
+
Text,
|
|
180
|
+
{
|
|
181
|
+
style: [
|
|
182
|
+
styles.helperText,
|
|
183
|
+
{
|
|
184
|
+
color: variantStyles.helperColor,
|
|
185
|
+
fontSize: sizeStyles.helperSize
|
|
186
|
+
},
|
|
187
|
+
customAppearance?.helperText
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
helperText
|
|
191
|
+
) : /* @__PURE__ */ React2.createElement(View, null, helperText) : null
|
|
192
|
+
);
|
|
193
|
+
};
|
|
6
194
|
export {
|
|
195
|
+
FileInputTrigger,
|
|
7
196
|
InputTrigger
|
|
8
197
|
};
|
|
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
3
3
|
import { T as ThemeColor, R as Radius } from './index-DyU3sW3_.cjs';
|
|
4
4
|
|
|
5
|
-
type InputTriggerVariant = '
|
|
5
|
+
type InputTriggerVariant = 'colored' | 'light' | 'bordered' | 'underlined';
|
|
6
6
|
type InputTriggerSize = 'sm' | 'md' | 'lg';
|
|
7
7
|
type InputTriggerLabelPlacement = 'outside' | 'inside';
|
|
8
8
|
type InputTriggerCustomAppearance = {
|
|
@@ -54,7 +54,7 @@ type InputTriggerProps = {
|
|
|
54
54
|
themeColor?: ThemeColor;
|
|
55
55
|
/**
|
|
56
56
|
* Visual style variant.
|
|
57
|
-
* @default '
|
|
57
|
+
* @default 'colored'
|
|
58
58
|
*/
|
|
59
59
|
variant?: InputTriggerVariant;
|
|
60
60
|
/**
|
|
@@ -93,5 +93,88 @@ type InputTriggerEvents = {
|
|
|
93
93
|
*/
|
|
94
94
|
onPress?: () => void;
|
|
95
95
|
};
|
|
96
|
+
type FileInputTriggerCustomAppearance = {
|
|
97
|
+
container?: StyleProp<ViewStyle>;
|
|
98
|
+
inputContainer?: StyleProp<ViewStyle>;
|
|
99
|
+
inputWrapper?: StyleProp<ViewStyle>;
|
|
100
|
+
plusButton?: StyleProp<ViewStyle>;
|
|
101
|
+
label?: StyleProp<TextStyle>;
|
|
102
|
+
content?: StyleProp<TextStyle>;
|
|
103
|
+
helperText?: StyleProp<TextStyle>;
|
|
104
|
+
};
|
|
105
|
+
type FileInputTriggerProps = {
|
|
106
|
+
/**
|
|
107
|
+
* Value rendered in the center content area.
|
|
108
|
+
*/
|
|
109
|
+
value?: ReactNode;
|
|
110
|
+
/**
|
|
111
|
+
* Placeholder text shown when value is empty.
|
|
112
|
+
*/
|
|
113
|
+
placeholder?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Label displayed above or inside the trigger.
|
|
116
|
+
*/
|
|
117
|
+
label?: ReactNode;
|
|
118
|
+
/**
|
|
119
|
+
* Position of the label relative to the trigger.
|
|
120
|
+
* @default 'outside'
|
|
121
|
+
*/
|
|
122
|
+
labelPlacement?: InputTriggerLabelPlacement;
|
|
123
|
+
/**
|
|
124
|
+
* Optional helper text below the trigger.
|
|
125
|
+
*/
|
|
126
|
+
description?: ReactNode;
|
|
127
|
+
/**
|
|
128
|
+
* Error text shown when isInvalid is true.
|
|
129
|
+
*/
|
|
130
|
+
errorMessage?: ReactNode;
|
|
131
|
+
/**
|
|
132
|
+
* Theme color for the trigger.
|
|
133
|
+
* @default 'primary'
|
|
134
|
+
*/
|
|
135
|
+
themeColor?: ThemeColor;
|
|
136
|
+
/**
|
|
137
|
+
* Visual style variant.
|
|
138
|
+
* @default 'colored'
|
|
139
|
+
*/
|
|
140
|
+
variant?: InputTriggerVariant;
|
|
141
|
+
/**
|
|
142
|
+
* Size of the trigger.
|
|
143
|
+
* @default 'md'
|
|
144
|
+
*/
|
|
145
|
+
size?: InputTriggerSize;
|
|
146
|
+
/**
|
|
147
|
+
* Border radius.
|
|
148
|
+
* @default 'md'
|
|
149
|
+
*/
|
|
150
|
+
radius?: Radius;
|
|
151
|
+
/**
|
|
152
|
+
* Whether the trigger is disabled.
|
|
153
|
+
* @default false
|
|
154
|
+
*/
|
|
155
|
+
isDisabled?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Whether the trigger is invalid.
|
|
158
|
+
* @default false
|
|
159
|
+
*/
|
|
160
|
+
isInvalid?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Whether the component takes full width.
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
fullWidth?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Optional fully custom center content.
|
|
168
|
+
*/
|
|
169
|
+
centerContent?: ReactNode;
|
|
170
|
+
/**
|
|
171
|
+
* Content shown when a file is selected (for image/video preview).
|
|
172
|
+
*/
|
|
173
|
+
selectedContent?: ReactNode;
|
|
174
|
+
/**
|
|
175
|
+
* Custom style overrides for file trigger parts.
|
|
176
|
+
*/
|
|
177
|
+
customAppearance?: FileInputTriggerCustomAppearance;
|
|
178
|
+
} & InputTriggerEvents;
|
|
96
179
|
|
|
97
|
-
export type { InputTriggerProps as I, InputTriggerEvents as a, InputTriggerVariant as b, InputTriggerSize as c, InputTriggerLabelPlacement as d, InputTriggerCustomAppearance as e };
|
|
180
|
+
export type { FileInputTriggerProps as F, InputTriggerProps as I, InputTriggerEvents as a, InputTriggerVariant as b, InputTriggerSize as c, InputTriggerLabelPlacement as d, InputTriggerCustomAppearance as e, FileInputTriggerCustomAppearance as f };
|
|
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
3
3
|
import { T as ThemeColor, R as Radius } from './index-DyU3sW3_.js';
|
|
4
4
|
|
|
5
|
-
type InputTriggerVariant = '
|
|
5
|
+
type InputTriggerVariant = 'colored' | 'light' | 'bordered' | 'underlined';
|
|
6
6
|
type InputTriggerSize = 'sm' | 'md' | 'lg';
|
|
7
7
|
type InputTriggerLabelPlacement = 'outside' | 'inside';
|
|
8
8
|
type InputTriggerCustomAppearance = {
|
|
@@ -54,7 +54,7 @@ type InputTriggerProps = {
|
|
|
54
54
|
themeColor?: ThemeColor;
|
|
55
55
|
/**
|
|
56
56
|
* Visual style variant.
|
|
57
|
-
* @default '
|
|
57
|
+
* @default 'colored'
|
|
58
58
|
*/
|
|
59
59
|
variant?: InputTriggerVariant;
|
|
60
60
|
/**
|
|
@@ -93,5 +93,88 @@ type InputTriggerEvents = {
|
|
|
93
93
|
*/
|
|
94
94
|
onPress?: () => void;
|
|
95
95
|
};
|
|
96
|
+
type FileInputTriggerCustomAppearance = {
|
|
97
|
+
container?: StyleProp<ViewStyle>;
|
|
98
|
+
inputContainer?: StyleProp<ViewStyle>;
|
|
99
|
+
inputWrapper?: StyleProp<ViewStyle>;
|
|
100
|
+
plusButton?: StyleProp<ViewStyle>;
|
|
101
|
+
label?: StyleProp<TextStyle>;
|
|
102
|
+
content?: StyleProp<TextStyle>;
|
|
103
|
+
helperText?: StyleProp<TextStyle>;
|
|
104
|
+
};
|
|
105
|
+
type FileInputTriggerProps = {
|
|
106
|
+
/**
|
|
107
|
+
* Value rendered in the center content area.
|
|
108
|
+
*/
|
|
109
|
+
value?: ReactNode;
|
|
110
|
+
/**
|
|
111
|
+
* Placeholder text shown when value is empty.
|
|
112
|
+
*/
|
|
113
|
+
placeholder?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Label displayed above or inside the trigger.
|
|
116
|
+
*/
|
|
117
|
+
label?: ReactNode;
|
|
118
|
+
/**
|
|
119
|
+
* Position of the label relative to the trigger.
|
|
120
|
+
* @default 'outside'
|
|
121
|
+
*/
|
|
122
|
+
labelPlacement?: InputTriggerLabelPlacement;
|
|
123
|
+
/**
|
|
124
|
+
* Optional helper text below the trigger.
|
|
125
|
+
*/
|
|
126
|
+
description?: ReactNode;
|
|
127
|
+
/**
|
|
128
|
+
* Error text shown when isInvalid is true.
|
|
129
|
+
*/
|
|
130
|
+
errorMessage?: ReactNode;
|
|
131
|
+
/**
|
|
132
|
+
* Theme color for the trigger.
|
|
133
|
+
* @default 'primary'
|
|
134
|
+
*/
|
|
135
|
+
themeColor?: ThemeColor;
|
|
136
|
+
/**
|
|
137
|
+
* Visual style variant.
|
|
138
|
+
* @default 'colored'
|
|
139
|
+
*/
|
|
140
|
+
variant?: InputTriggerVariant;
|
|
141
|
+
/**
|
|
142
|
+
* Size of the trigger.
|
|
143
|
+
* @default 'md'
|
|
144
|
+
*/
|
|
145
|
+
size?: InputTriggerSize;
|
|
146
|
+
/**
|
|
147
|
+
* Border radius.
|
|
148
|
+
* @default 'md'
|
|
149
|
+
*/
|
|
150
|
+
radius?: Radius;
|
|
151
|
+
/**
|
|
152
|
+
* Whether the trigger is disabled.
|
|
153
|
+
* @default false
|
|
154
|
+
*/
|
|
155
|
+
isDisabled?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Whether the trigger is invalid.
|
|
158
|
+
* @default false
|
|
159
|
+
*/
|
|
160
|
+
isInvalid?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Whether the component takes full width.
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
fullWidth?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Optional fully custom center content.
|
|
168
|
+
*/
|
|
169
|
+
centerContent?: ReactNode;
|
|
170
|
+
/**
|
|
171
|
+
* Content shown when a file is selected (for image/video preview).
|
|
172
|
+
*/
|
|
173
|
+
selectedContent?: ReactNode;
|
|
174
|
+
/**
|
|
175
|
+
* Custom style overrides for file trigger parts.
|
|
176
|
+
*/
|
|
177
|
+
customAppearance?: FileInputTriggerCustomAppearance;
|
|
178
|
+
} & InputTriggerEvents;
|
|
96
179
|
|
|
97
|
-
export type { InputTriggerProps as I, InputTriggerEvents as a, InputTriggerVariant as b, InputTriggerSize as c, InputTriggerLabelPlacement as d, InputTriggerCustomAppearance as e };
|
|
180
|
+
export type { FileInputTriggerProps as F, InputTriggerProps as I, InputTriggerEvents as a, InputTriggerVariant as b, InputTriggerSize as c, InputTriggerLabelPlacement as d, InputTriggerCustomAppearance as e, FileInputTriggerCustomAppearance as f };
|