@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
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import "../chunk-SHBDANQN.js";
|
|
2
|
+
import {
|
|
3
|
+
useXUITheme
|
|
4
|
+
} from "../chunk-RBSA4NH4.js";
|
|
5
|
+
|
|
6
|
+
// src/components/refresh-control/refresh-control.tsx
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { RefreshControl as RNRefreshControl } from "react-native";
|
|
9
|
+
var PullToRefresh = ({
|
|
10
|
+
refreshing,
|
|
11
|
+
onRefresh,
|
|
12
|
+
enabled = true,
|
|
13
|
+
themeColor = "primary",
|
|
14
|
+
color,
|
|
15
|
+
title,
|
|
16
|
+
titleColor,
|
|
17
|
+
progressViewOffset,
|
|
18
|
+
children,
|
|
19
|
+
refreshControlProps
|
|
20
|
+
}) => {
|
|
21
|
+
const theme = useXUITheme();
|
|
22
|
+
const indicatorColor = color ?? theme.colors[themeColor].main;
|
|
23
|
+
const indicatorTitleColor = titleColor ?? theme.colors.foreground;
|
|
24
|
+
const refreshControl = /* @__PURE__ */ React.createElement(
|
|
25
|
+
RNRefreshControl,
|
|
26
|
+
{
|
|
27
|
+
refreshing,
|
|
28
|
+
onRefresh,
|
|
29
|
+
enabled,
|
|
30
|
+
colors: [indicatorColor],
|
|
31
|
+
tintColor: indicatorColor,
|
|
32
|
+
title,
|
|
33
|
+
titleColor: indicatorTitleColor,
|
|
34
|
+
progressViewOffset,
|
|
35
|
+
...refreshControlProps
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
return React.cloneElement(children, {
|
|
39
|
+
refreshControl
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
PullToRefresh.displayName = "PullToRefresh";
|
|
43
|
+
export {
|
|
44
|
+
PullToRefresh
|
|
45
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
|
|
6
6
|
|
|
7
7
|
// src/components/segment-button/segment-button.tsx
|
|
8
8
|
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
@@ -53,7 +53,7 @@ var styles = _reactnative.StyleSheet.create({
|
|
|
53
53
|
|
|
54
54
|
var _core = require('@xaui/core');
|
|
55
55
|
function useSegmentSizeStyles(size) {
|
|
56
|
-
const theme =
|
|
56
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
57
57
|
return _react.useMemo.call(void 0, () => {
|
|
58
58
|
const sizes = {
|
|
59
59
|
xs: {
|
|
@@ -89,7 +89,7 @@ function useSegmentSizeStyles(size) {
|
|
|
89
89
|
}, [size, theme]);
|
|
90
90
|
}
|
|
91
91
|
function useSegmentVariantStyles(themeColor, variant, elevation = 0) {
|
|
92
|
-
const theme =
|
|
92
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
93
93
|
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
94
94
|
const colorScheme = theme.colors[safeThemeColor];
|
|
95
95
|
const selectedBackgroundColor = _core.withPaletteNumber.call(void 0, colorScheme.main, 400);
|
|
@@ -101,11 +101,11 @@ function useSegmentVariantStyles(themeColor, variant, elevation = 0) {
|
|
|
101
101
|
containerBorderColor: colorScheme.main,
|
|
102
102
|
selectedBackground: selectedBackgroundColor,
|
|
103
103
|
unselectedBackground: "transparent",
|
|
104
|
-
selectedTextColor: colorScheme.
|
|
104
|
+
selectedTextColor: colorScheme.onMain,
|
|
105
105
|
unselectedTextColor: colorScheme.main
|
|
106
106
|
},
|
|
107
107
|
flat: {
|
|
108
|
-
containerBackground: colorScheme.
|
|
108
|
+
containerBackground: colorScheme.container,
|
|
109
109
|
containerBorderWidth: 0,
|
|
110
110
|
containerBorderColor: "transparent",
|
|
111
111
|
selectedBackground: _core.withOpacity.call(void 0, colorScheme.main, 0.2),
|
|
@@ -119,11 +119,11 @@ function useSegmentVariantStyles(themeColor, variant, elevation = 0) {
|
|
|
119
119
|
containerBorderColor: "transparent",
|
|
120
120
|
selectedBackground: selectedBackgroundColor,
|
|
121
121
|
unselectedBackground: "transparent",
|
|
122
|
-
selectedTextColor: colorScheme.
|
|
122
|
+
selectedTextColor: colorScheme.onMain,
|
|
123
123
|
unselectedTextColor: colorScheme.main
|
|
124
124
|
},
|
|
125
125
|
faded: {
|
|
126
|
-
containerBackground:
|
|
126
|
+
containerBackground: _core.withOpacity.call(void 0, colorScheme.container, 0.58),
|
|
127
127
|
containerBorderWidth: theme.borderWidth.md,
|
|
128
128
|
containerBorderColor: `${colorScheme.main}90`,
|
|
129
129
|
selectedBackground: _core.withOpacity.call(void 0, colorScheme.main, 0.2),
|
|
@@ -182,7 +182,7 @@ var SegmentButton = ({
|
|
|
182
182
|
return selected ? [selected] : [];
|
|
183
183
|
}, [selected]);
|
|
184
184
|
const variantStyles = useSegmentVariantStyles(themeColor, variant, elevation);
|
|
185
|
-
const radiusStyles =
|
|
185
|
+
const radiusStyles = _chunk7UFBLUMVcjs.useBorderRadiusStyles.call(void 0, radius);
|
|
186
186
|
const toggleItem = _react.useCallback.call(void 0,
|
|
187
187
|
(key) => {
|
|
188
188
|
let nextSelected;
|
|
@@ -2,7 +2,7 @@ import "../chunk-SHBDANQN.js";
|
|
|
2
2
|
import {
|
|
3
3
|
useBorderRadiusStyles,
|
|
4
4
|
useXUITheme
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-RBSA4NH4.js";
|
|
6
6
|
|
|
7
7
|
// src/components/segment-button/segment-button.tsx
|
|
8
8
|
import React, { useCallback, useMemo as useMemo2, useState } from "react";
|
|
@@ -101,11 +101,11 @@ function useSegmentVariantStyles(themeColor, variant, elevation = 0) {
|
|
|
101
101
|
containerBorderColor: colorScheme.main,
|
|
102
102
|
selectedBackground: selectedBackgroundColor,
|
|
103
103
|
unselectedBackground: "transparent",
|
|
104
|
-
selectedTextColor: colorScheme.
|
|
104
|
+
selectedTextColor: colorScheme.onMain,
|
|
105
105
|
unselectedTextColor: colorScheme.main
|
|
106
106
|
},
|
|
107
107
|
flat: {
|
|
108
|
-
containerBackground: colorScheme.
|
|
108
|
+
containerBackground: colorScheme.container,
|
|
109
109
|
containerBorderWidth: 0,
|
|
110
110
|
containerBorderColor: "transparent",
|
|
111
111
|
selectedBackground: withOpacity(colorScheme.main, 0.2),
|
|
@@ -119,11 +119,11 @@ function useSegmentVariantStyles(themeColor, variant, elevation = 0) {
|
|
|
119
119
|
containerBorderColor: "transparent",
|
|
120
120
|
selectedBackground: selectedBackgroundColor,
|
|
121
121
|
unselectedBackground: "transparent",
|
|
122
|
-
selectedTextColor: colorScheme.
|
|
122
|
+
selectedTextColor: colorScheme.onMain,
|
|
123
123
|
unselectedTextColor: colorScheme.main
|
|
124
124
|
},
|
|
125
125
|
faded: {
|
|
126
|
-
containerBackground:
|
|
126
|
+
containerBackground: withOpacity(colorScheme.container, 0.58),
|
|
127
127
|
containerBorderWidth: theme.borderWidth.md,
|
|
128
128
|
containerBorderColor: `${colorScheme.main}90`,
|
|
129
129
|
selectedBackground: withOpacity(colorScheme.main, 0.2),
|
package/dist/select/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var _chunkDHSTKO3Kcjs = require('../chunk-DHSTKO3K.cjs');
|
|
|
4
4
|
require('../chunk-56RPWZD2.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
|
|
8
8
|
|
|
9
9
|
// src/components/select/select.tsx
|
|
10
10
|
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
@@ -27,13 +27,13 @@ var SelectContext = _react.createContext.call(void 0, null);
|
|
|
27
27
|
var _core = require('@xaui/core');
|
|
28
28
|
var _palette = require('@xaui/core/palette');
|
|
29
29
|
var useSelectColorScheme = (themeColor) => {
|
|
30
|
-
const theme =
|
|
30
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
31
31
|
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
32
32
|
const colorScheme = theme.colors[safeThemeColor];
|
|
33
33
|
return { theme, colorScheme };
|
|
34
34
|
};
|
|
35
35
|
var useSelectSizeStyles = (size) => {
|
|
36
|
-
const theme =
|
|
36
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
37
37
|
return _react.useMemo.call(void 0, () => {
|
|
38
38
|
const sizes = {
|
|
39
39
|
xs: {
|
|
@@ -69,7 +69,7 @@ var useSelectSizeStyles = (size) => {
|
|
|
69
69
|
}, [size, theme]);
|
|
70
70
|
};
|
|
71
71
|
var useSelectRadiusStyles = (radius) => {
|
|
72
|
-
const theme =
|
|
72
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
73
73
|
const radiusStyles = _react.useMemo.call(void 0, () => {
|
|
74
74
|
const radii = {
|
|
75
75
|
none: theme.borderRadius.none,
|
|
@@ -96,28 +96,23 @@ var useSelectVariantStyles = (themeColor, variant, isInvalid) => {
|
|
|
96
96
|
const { theme, colorScheme } = useSelectColorScheme(themeColor);
|
|
97
97
|
return _react.useMemo.call(void 0, () => {
|
|
98
98
|
let borderColor = isInvalid ? theme.colors.danger.main : colorScheme.main;
|
|
99
|
-
if (
|
|
99
|
+
if (variant === "bordered" && themeColor === "default") {
|
|
100
100
|
borderColor = _palette.colors.gray[300];
|
|
101
101
|
}
|
|
102
102
|
const styles3 = {
|
|
103
|
-
|
|
103
|
+
bordered: {
|
|
104
104
|
backgroundColor: "transparent",
|
|
105
105
|
borderWidth: theme.borderWidth.md,
|
|
106
106
|
borderColor
|
|
107
107
|
},
|
|
108
|
-
|
|
109
|
-
backgroundColor: colorScheme.
|
|
108
|
+
colored: {
|
|
109
|
+
backgroundColor: _core.withOpacity.call(void 0, colorScheme.container, 0.5),
|
|
110
110
|
borderWidth: 0
|
|
111
111
|
},
|
|
112
112
|
light: {
|
|
113
113
|
backgroundColor: "transparent",
|
|
114
114
|
borderWidth: 0
|
|
115
115
|
},
|
|
116
|
-
faded: {
|
|
117
|
-
backgroundColor: `${colorScheme.background}90`,
|
|
118
|
-
borderWidth: theme.borderWidth.md,
|
|
119
|
-
borderColor
|
|
120
|
-
},
|
|
121
116
|
underlined: {
|
|
122
117
|
backgroundColor: "transparent",
|
|
123
118
|
borderBottomWidth: theme.borderWidth.md,
|
|
@@ -143,7 +138,7 @@ var useSelectLabelStyle = (themeColor, isInvalid, labelSize) => {
|
|
|
143
138
|
}, [isInvalid, labelSize, theme, themeColor, colorScheme]);
|
|
144
139
|
};
|
|
145
140
|
var useSelectValueColor = (isInvalid, shouldShowPlaceholder) => {
|
|
146
|
-
const theme =
|
|
141
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
147
142
|
return _react.useMemo.call(void 0, () => {
|
|
148
143
|
if (isInvalid) {
|
|
149
144
|
return theme.colors.danger.main;
|
|
@@ -155,7 +150,7 @@ var useSelectValueColor = (isInvalid, shouldShowPlaceholder) => {
|
|
|
155
150
|
}, [isInvalid, shouldShowPlaceholder, theme]);
|
|
156
151
|
};
|
|
157
152
|
var useSelectHelperColor = (isInvalid) => {
|
|
158
|
-
const theme =
|
|
153
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
159
154
|
return _react.useMemo.call(void 0, () => {
|
|
160
155
|
if (isInvalid) {
|
|
161
156
|
return theme.colors.danger.main;
|
|
@@ -164,7 +159,7 @@ var useSelectHelperColor = (isInvalid) => {
|
|
|
164
159
|
}, [isInvalid, theme]);
|
|
165
160
|
};
|
|
166
161
|
var useSelectSelectorColor = (isInvalid, shouldShowPlaceholder) => {
|
|
167
|
-
const theme =
|
|
162
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
168
163
|
return _react.useMemo.call(void 0, () => {
|
|
169
164
|
if (isInvalid) {
|
|
170
165
|
return theme.colors.danger.main;
|
|
@@ -236,13 +231,15 @@ var styles = _reactnative.StyleSheet.create({
|
|
|
236
231
|
},
|
|
237
232
|
overlay: {
|
|
238
233
|
flex: 1,
|
|
239
|
-
backgroundColor: "rgba(0, 0, 0, 0.
|
|
234
|
+
backgroundColor: "rgba(0, 0, 0, 0.70)",
|
|
235
|
+
justifyContent: "center",
|
|
236
|
+
alignItems: "center"
|
|
240
237
|
},
|
|
241
238
|
listbox: {
|
|
242
239
|
overflow: "hidden"
|
|
243
240
|
},
|
|
244
241
|
listboxContent: {
|
|
245
|
-
|
|
242
|
+
minWidth: "100%"
|
|
246
243
|
},
|
|
247
244
|
dialogTitle: {
|
|
248
245
|
fontWeight: "600",
|
|
@@ -334,7 +331,7 @@ var SelectTrigger = ({
|
|
|
334
331
|
accessibilityState: { disabled: isDisabled, expanded: isOpen },
|
|
335
332
|
style: [
|
|
336
333
|
styles.trigger,
|
|
337
|
-
radiusStyles,
|
|
334
|
+
variant === "underlined" ? { borderRadius: 0 } : radiusStyles,
|
|
338
335
|
variantStyles,
|
|
339
336
|
{
|
|
340
337
|
minHeight: sizeStyles.minHeight,
|
|
@@ -501,7 +498,7 @@ var Select = ({
|
|
|
501
498
|
selectedKeys,
|
|
502
499
|
disabledKeys,
|
|
503
500
|
defaultSelectedKeys,
|
|
504
|
-
variant = "
|
|
501
|
+
variant = "colored",
|
|
505
502
|
themeColor = "default",
|
|
506
503
|
size = "md",
|
|
507
504
|
radius = "md",
|
|
@@ -538,8 +535,9 @@ var Select = ({
|
|
|
538
535
|
onSelectionChange,
|
|
539
536
|
onClear
|
|
540
537
|
});
|
|
541
|
-
const { triggerRef,
|
|
538
|
+
const { triggerRef, handleTriggerLayout } = useSelectTriggerMeasurements(isOpen);
|
|
542
539
|
const { animationOpacity, animationScale } = useSelectListboxAnimation(isOpen);
|
|
540
|
+
const { width: screenWidth, height: screenHeight } = _reactnative.useWindowDimensions.call(void 0, );
|
|
543
541
|
const disabledKeySet = _react.useMemo.call(void 0, () => {
|
|
544
542
|
return new Set(_nullishCoalesce(disabledKeys, () => ( [])));
|
|
545
543
|
}, [disabledKeys]);
|
|
@@ -564,7 +562,7 @@ var Select = ({
|
|
|
564
562
|
}, [currentSelectedKeys, items]);
|
|
565
563
|
const displayValue = selectedLabels.length ? selectedLabels.join(", ") : placeholder;
|
|
566
564
|
const shouldShowPlaceholder = selectedLabels.length === 0;
|
|
567
|
-
const theme =
|
|
565
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
568
566
|
const sizeStyles = useSelectSizeStyles(size);
|
|
569
567
|
const { radiusStyles, listboxRadius } = useSelectRadiusStyles(radius);
|
|
570
568
|
const variantStyles = useSelectVariantStyles(themeColor, variant, isInvalid);
|
|
@@ -607,18 +605,8 @@ var Select = ({
|
|
|
607
605
|
const dialogTitle = typeof label === "string" || typeof label === "number" ? String(label) : void 0;
|
|
608
606
|
const shouldShowHelper = Boolean(hint || errorMessage);
|
|
609
607
|
const helperContent = isInvalid && errorMessage ? errorMessage : hint;
|
|
610
|
-
const
|
|
611
|
-
const
|
|
612
|
-
const listboxPosition = _react.useMemo.call(void 0, () => {
|
|
613
|
-
if (!triggerPosition) {
|
|
614
|
-
return { top: 0, left: 0 };
|
|
615
|
-
}
|
|
616
|
-
const listWidth = listboxWidth || 0;
|
|
617
|
-
const centeredLeft = triggerPosition.x + triggerPosition.width / 2 - listWidth / 2;
|
|
618
|
-
const left = Math.max(12, Math.min(centeredLeft, screenWidth - listWidth - 12));
|
|
619
|
-
const top = Math.max(12, triggerPosition.y);
|
|
620
|
-
return { top, left };
|
|
621
|
-
}, [triggerPosition, listboxWidth, screenWidth]);
|
|
608
|
+
const dialogWidth = screenWidth * 0.9;
|
|
609
|
+
const dialogMaxHeight = Math.min(screenHeight * 0.6, maxListboxHeight);
|
|
622
610
|
const listItems = items.map((item) => {
|
|
623
611
|
const itemProps = item.element.props;
|
|
624
612
|
const itemDisabled = isDisabled || itemProps.isDisabled || disabledKeySet.has(item.key);
|
|
@@ -628,7 +616,7 @@ var Select = ({
|
|
|
628
616
|
return;
|
|
629
617
|
}
|
|
630
618
|
handleItemSelection(item.key);
|
|
631
|
-
_optionalChain([itemProps, 'access',
|
|
619
|
+
_optionalChain([itemProps, 'access', _8 => _8.onSelected, 'optionalCall', _9 => _9()]);
|
|
632
620
|
};
|
|
633
621
|
return _react2.default.cloneElement(item.element, {
|
|
634
622
|
key: item.key,
|
|
@@ -682,11 +670,8 @@ var Select = ({
|
|
|
682
670
|
style: [
|
|
683
671
|
styles.listbox,
|
|
684
672
|
{
|
|
685
|
-
width:
|
|
686
|
-
maxHeight:
|
|
687
|
-
position: "absolute",
|
|
688
|
-
top: listboxPosition.top,
|
|
689
|
-
left: listboxPosition.left,
|
|
673
|
+
width: dialogWidth,
|
|
674
|
+
maxHeight: dialogMaxHeight,
|
|
690
675
|
borderRadius: listboxRadius,
|
|
691
676
|
backgroundColor: theme.colors.background,
|
|
692
677
|
opacity: animationOpacity,
|
|
@@ -699,18 +684,25 @@ var Select = ({
|
|
|
699
684
|
_reactnative.Pressable,
|
|
700
685
|
{
|
|
701
686
|
onPress: (event) => event.stopPropagation(),
|
|
702
|
-
style: {
|
|
687
|
+
style: { maxHeight: dialogMaxHeight }
|
|
703
688
|
},
|
|
704
|
-
/* @__PURE__ */ _react2.default.createElement(SelectContext.Provider, { value: { size, themeColor, isDisabled } }, /* @__PURE__ */ _react2.default.createElement(
|
|
705
|
-
_reactnative.
|
|
689
|
+
/* @__PURE__ */ _react2.default.createElement(SelectContext.Provider, { value: { size, themeColor, isDisabled } }, /* @__PURE__ */ _react2.default.createElement(
|
|
690
|
+
_reactnative.View,
|
|
706
691
|
{
|
|
707
|
-
style: [
|
|
708
|
-
styles.dialogTitle,
|
|
709
|
-
{ color: theme.colors.foreground }
|
|
710
|
-
]
|
|
692
|
+
style: [styles.listboxContent, { maxHeight: dialogMaxHeight }]
|
|
711
693
|
},
|
|
712
|
-
dialogTitle
|
|
713
|
-
|
|
694
|
+
dialogTitle ? /* @__PURE__ */ _react2.default.createElement(
|
|
695
|
+
_reactnative.Text,
|
|
696
|
+
{
|
|
697
|
+
style: [
|
|
698
|
+
styles.dialogTitle,
|
|
699
|
+
{ color: theme.colors.foreground }
|
|
700
|
+
]
|
|
701
|
+
},
|
|
702
|
+
dialogTitle
|
|
703
|
+
) : null,
|
|
704
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.ScrollView, { style: { maxHeight: dialogMaxHeight } }, listItems)
|
|
705
|
+
))
|
|
714
706
|
)
|
|
715
707
|
))
|
|
716
708
|
));
|
|
@@ -724,7 +716,7 @@ var Select = ({
|
|
|
724
716
|
|
|
725
717
|
|
|
726
718
|
var useSelectItemSizeStyles = (size) => {
|
|
727
|
-
const theme =
|
|
719
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
728
720
|
return _react.useMemo.call(void 0, () => {
|
|
729
721
|
const sizes = {
|
|
730
722
|
xs: {
|
|
@@ -756,18 +748,18 @@ var useSelectItemSizeStyles = (size) => {
|
|
|
756
748
|
}, [size, theme]);
|
|
757
749
|
};
|
|
758
750
|
var useSelectItemBackgroundColor = (themeColor, isSelected) => {
|
|
759
|
-
const theme =
|
|
751
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
760
752
|
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
761
753
|
const colorScheme = theme.colors[safeThemeColor];
|
|
762
754
|
return _react.useMemo.call(void 0, () => {
|
|
763
755
|
if (isSelected) {
|
|
764
|
-
return colorScheme.
|
|
756
|
+
return colorScheme.container;
|
|
765
757
|
}
|
|
766
758
|
return "transparent";
|
|
767
759
|
}, [isSelected, colorScheme]);
|
|
768
760
|
};
|
|
769
761
|
var useSelectItemTextColors = () => {
|
|
770
|
-
const theme =
|
|
762
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
771
763
|
return _react.useMemo.call(void 0, () => {
|
|
772
764
|
return {
|
|
773
765
|
textColor: theme.colors.foreground,
|
|
@@ -776,7 +768,7 @@ var useSelectItemTextColors = () => {
|
|
|
776
768
|
}, [theme]);
|
|
777
769
|
};
|
|
778
770
|
var useSelectItemCheckmarkColor = (themeColor) => {
|
|
779
|
-
const theme =
|
|
771
|
+
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
780
772
|
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
781
773
|
const colorScheme = theme.colors[safeThemeColor];
|
|
782
774
|
return _react.useMemo.call(void 0, () => {
|
|
@@ -826,9 +818,9 @@ var SelectItem = ({
|
|
|
826
818
|
onSelected
|
|
827
819
|
}) => {
|
|
828
820
|
const context = _react.useContext.call(void 0, SelectContext);
|
|
829
|
-
const size = _nullishCoalesce(_optionalChain([context, 'optionalAccess',
|
|
830
|
-
const themeColor = _nullishCoalesce(_optionalChain([context, 'optionalAccess',
|
|
831
|
-
const isItemDisabled = _optionalChain([context, 'optionalAccess',
|
|
821
|
+
const size = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _10 => _10.size]), () => ( defaultSize));
|
|
822
|
+
const themeColor = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _11 => _11.themeColor]), () => ( "default"));
|
|
823
|
+
const isItemDisabled = _optionalChain([context, 'optionalAccess', _12 => _12.isDisabled]) ? true : isDisabled;
|
|
832
824
|
const sizeStyles = useSelectItemSizeStyles(size);
|
|
833
825
|
const backgroundColor = useSelectItemBackgroundColor(themeColor, isSelected);
|
|
834
826
|
const { textColor, descriptionColor } = useSelectItemTextColors();
|
|
@@ -837,7 +829,7 @@ var SelectItem = ({
|
|
|
837
829
|
if (isItemDisabled || isReadOnly) {
|
|
838
830
|
return;
|
|
839
831
|
}
|
|
840
|
-
_optionalChain([onSelected, 'optionalCall',
|
|
832
|
+
_optionalChain([onSelected, 'optionalCall', _13 => _13()]);
|
|
841
833
|
};
|
|
842
834
|
return /* @__PURE__ */ _react2.default.createElement(
|
|
843
835
|
_reactnative.Pressable,
|
package/dist/select/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
3
|
import { T as ThemeColor, S as Size, R as Radius } from '../index-BOw6tbkc.cjs';
|
|
4
4
|
|
|
5
|
-
type SelectVariant = '
|
|
5
|
+
type SelectVariant = 'bordered' | 'colored' | 'light' | 'underlined';
|
|
6
6
|
type SelectLabelPlacement = 'inside' | 'outside' | 'outside-left' | 'outside-top';
|
|
7
7
|
type SelectSelectionMode = 'single' | 'multiple';
|
|
8
8
|
type SelectProps = {
|
|
@@ -29,7 +29,7 @@ type SelectProps = {
|
|
|
29
29
|
defaultSelectedKeys?: string[];
|
|
30
30
|
/**
|
|
31
31
|
* Variant of the select trigger.
|
|
32
|
-
* @default '
|
|
32
|
+
* @default 'colored'
|
|
33
33
|
*/
|
|
34
34
|
variant?: SelectVariant;
|
|
35
35
|
/**
|
package/dist/select/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
3
|
import { T as ThemeColor, S as Size, R as Radius } from '../index-BOw6tbkc.js';
|
|
4
4
|
|
|
5
|
-
type SelectVariant = '
|
|
5
|
+
type SelectVariant = 'bordered' | 'colored' | 'light' | 'underlined';
|
|
6
6
|
type SelectLabelPlacement = 'inside' | 'outside' | 'outside-left' | 'outside-top';
|
|
7
7
|
type SelectSelectionMode = 'single' | 'multiple';
|
|
8
8
|
type SelectProps = {
|
|
@@ -29,7 +29,7 @@ type SelectProps = {
|
|
|
29
29
|
defaultSelectedKeys?: string[];
|
|
30
30
|
/**
|
|
31
31
|
* Variant of the select trigger.
|
|
32
|
-
* @default '
|
|
32
|
+
* @default 'colored'
|
|
33
33
|
*/
|
|
34
34
|
variant?: SelectVariant;
|
|
35
35
|
/**
|
package/dist/select/index.js
CHANGED
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
import "../chunk-SHBDANQN.js";
|
|
5
5
|
import {
|
|
6
6
|
useXUITheme
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-RBSA4NH4.js";
|
|
8
8
|
|
|
9
9
|
// src/components/select/select.tsx
|
|
10
10
|
import React3, { useCallback as useCallback2, useMemo as useMemo2 } from "react";
|
|
11
11
|
import {
|
|
12
12
|
Animated as Animated3,
|
|
13
|
-
Dimensions,
|
|
14
13
|
Modal,
|
|
15
14
|
Pressable as Pressable2,
|
|
16
15
|
ScrollView,
|
|
17
16
|
Text as Text2,
|
|
18
|
-
View as View2
|
|
17
|
+
View as View2,
|
|
18
|
+
useWindowDimensions
|
|
19
19
|
} from "react-native";
|
|
20
20
|
|
|
21
21
|
// src/components/select/select-context.ts
|
|
@@ -24,7 +24,7 @@ var SelectContext = createContext(null);
|
|
|
24
24
|
|
|
25
25
|
// src/components/select/select.hook.ts
|
|
26
26
|
import { useMemo } from "react";
|
|
27
|
-
import { getSafeThemeColor } from "@xaui/core";
|
|
27
|
+
import { getSafeThemeColor, withOpacity } from "@xaui/core";
|
|
28
28
|
import { colors } from "@xaui/core/palette";
|
|
29
29
|
var useSelectColorScheme = (themeColor) => {
|
|
30
30
|
const theme = useXUITheme();
|
|
@@ -96,28 +96,23 @@ var useSelectVariantStyles = (themeColor, variant, isInvalid) => {
|
|
|
96
96
|
const { theme, colorScheme } = useSelectColorScheme(themeColor);
|
|
97
97
|
return useMemo(() => {
|
|
98
98
|
let borderColor = isInvalid ? theme.colors.danger.main : colorScheme.main;
|
|
99
|
-
if (
|
|
99
|
+
if (variant === "bordered" && themeColor === "default") {
|
|
100
100
|
borderColor = colors.gray[300];
|
|
101
101
|
}
|
|
102
102
|
const styles3 = {
|
|
103
|
-
|
|
103
|
+
bordered: {
|
|
104
104
|
backgroundColor: "transparent",
|
|
105
105
|
borderWidth: theme.borderWidth.md,
|
|
106
106
|
borderColor
|
|
107
107
|
},
|
|
108
|
-
|
|
109
|
-
backgroundColor: colorScheme.
|
|
108
|
+
colored: {
|
|
109
|
+
backgroundColor: withOpacity(colorScheme.container, 0.5),
|
|
110
110
|
borderWidth: 0
|
|
111
111
|
},
|
|
112
112
|
light: {
|
|
113
113
|
backgroundColor: "transparent",
|
|
114
114
|
borderWidth: 0
|
|
115
115
|
},
|
|
116
|
-
faded: {
|
|
117
|
-
backgroundColor: `${colorScheme.background}90`,
|
|
118
|
-
borderWidth: theme.borderWidth.md,
|
|
119
|
-
borderColor
|
|
120
|
-
},
|
|
121
116
|
underlined: {
|
|
122
117
|
backgroundColor: "transparent",
|
|
123
118
|
borderBottomWidth: theme.borderWidth.md,
|
|
@@ -236,13 +231,15 @@ var styles = StyleSheet.create({
|
|
|
236
231
|
},
|
|
237
232
|
overlay: {
|
|
238
233
|
flex: 1,
|
|
239
|
-
backgroundColor: "rgba(0, 0, 0, 0.
|
|
234
|
+
backgroundColor: "rgba(0, 0, 0, 0.70)",
|
|
235
|
+
justifyContent: "center",
|
|
236
|
+
alignItems: "center"
|
|
240
237
|
},
|
|
241
238
|
listbox: {
|
|
242
239
|
overflow: "hidden"
|
|
243
240
|
},
|
|
244
241
|
listboxContent: {
|
|
245
|
-
|
|
242
|
+
minWidth: "100%"
|
|
246
243
|
},
|
|
247
244
|
dialogTitle: {
|
|
248
245
|
fontWeight: "600",
|
|
@@ -334,7 +331,7 @@ var SelectTrigger = ({
|
|
|
334
331
|
accessibilityState: { disabled: isDisabled, expanded: isOpen },
|
|
335
332
|
style: [
|
|
336
333
|
styles.trigger,
|
|
337
|
-
radiusStyles,
|
|
334
|
+
variant === "underlined" ? { borderRadius: 0 } : radiusStyles,
|
|
338
335
|
variantStyles,
|
|
339
336
|
{
|
|
340
337
|
minHeight: sizeStyles.minHeight,
|
|
@@ -501,7 +498,7 @@ var Select = ({
|
|
|
501
498
|
selectedKeys,
|
|
502
499
|
disabledKeys,
|
|
503
500
|
defaultSelectedKeys,
|
|
504
|
-
variant = "
|
|
501
|
+
variant = "colored",
|
|
505
502
|
themeColor = "default",
|
|
506
503
|
size = "md",
|
|
507
504
|
radius = "md",
|
|
@@ -538,8 +535,9 @@ var Select = ({
|
|
|
538
535
|
onSelectionChange,
|
|
539
536
|
onClear
|
|
540
537
|
});
|
|
541
|
-
const { triggerRef,
|
|
538
|
+
const { triggerRef, handleTriggerLayout } = useSelectTriggerMeasurements(isOpen);
|
|
542
539
|
const { animationOpacity, animationScale } = useSelectListboxAnimation(isOpen);
|
|
540
|
+
const { width: screenWidth, height: screenHeight } = useWindowDimensions();
|
|
543
541
|
const disabledKeySet = useMemo2(() => {
|
|
544
542
|
return new Set(disabledKeys ?? []);
|
|
545
543
|
}, [disabledKeys]);
|
|
@@ -607,18 +605,8 @@ var Select = ({
|
|
|
607
605
|
const dialogTitle = typeof label === "string" || typeof label === "number" ? String(label) : void 0;
|
|
608
606
|
const shouldShowHelper = Boolean(hint || errorMessage);
|
|
609
607
|
const helperContent = isInvalid && errorMessage ? errorMessage : hint;
|
|
610
|
-
const
|
|
611
|
-
const
|
|
612
|
-
const listboxPosition = useMemo2(() => {
|
|
613
|
-
if (!triggerPosition) {
|
|
614
|
-
return { top: 0, left: 0 };
|
|
615
|
-
}
|
|
616
|
-
const listWidth = listboxWidth || 0;
|
|
617
|
-
const centeredLeft = triggerPosition.x + triggerPosition.width / 2 - listWidth / 2;
|
|
618
|
-
const left = Math.max(12, Math.min(centeredLeft, screenWidth - listWidth - 12));
|
|
619
|
-
const top = Math.max(12, triggerPosition.y);
|
|
620
|
-
return { top, left };
|
|
621
|
-
}, [triggerPosition, listboxWidth, screenWidth]);
|
|
608
|
+
const dialogWidth = screenWidth * 0.9;
|
|
609
|
+
const dialogMaxHeight = Math.min(screenHeight * 0.6, maxListboxHeight);
|
|
622
610
|
const listItems = items.map((item) => {
|
|
623
611
|
const itemProps = item.element.props;
|
|
624
612
|
const itemDisabled = isDisabled || itemProps.isDisabled || disabledKeySet.has(item.key);
|
|
@@ -682,11 +670,8 @@ var Select = ({
|
|
|
682
670
|
style: [
|
|
683
671
|
styles.listbox,
|
|
684
672
|
{
|
|
685
|
-
width:
|
|
686
|
-
maxHeight:
|
|
687
|
-
position: "absolute",
|
|
688
|
-
top: listboxPosition.top,
|
|
689
|
-
left: listboxPosition.left,
|
|
673
|
+
width: dialogWidth,
|
|
674
|
+
maxHeight: dialogMaxHeight,
|
|
690
675
|
borderRadius: listboxRadius,
|
|
691
676
|
backgroundColor: theme.colors.background,
|
|
692
677
|
opacity: animationOpacity,
|
|
@@ -699,18 +684,25 @@ var Select = ({
|
|
|
699
684
|
Pressable2,
|
|
700
685
|
{
|
|
701
686
|
onPress: (event) => event.stopPropagation(),
|
|
702
|
-
style: {
|
|
687
|
+
style: { maxHeight: dialogMaxHeight }
|
|
703
688
|
},
|
|
704
|
-
/* @__PURE__ */ React3.createElement(SelectContext.Provider, { value: { size, themeColor, isDisabled } }, /* @__PURE__ */ React3.createElement(
|
|
705
|
-
|
|
689
|
+
/* @__PURE__ */ React3.createElement(SelectContext.Provider, { value: { size, themeColor, isDisabled } }, /* @__PURE__ */ React3.createElement(
|
|
690
|
+
View2,
|
|
706
691
|
{
|
|
707
|
-
style: [
|
|
708
|
-
styles.dialogTitle,
|
|
709
|
-
{ color: theme.colors.foreground }
|
|
710
|
-
]
|
|
692
|
+
style: [styles.listboxContent, { maxHeight: dialogMaxHeight }]
|
|
711
693
|
},
|
|
712
|
-
dialogTitle
|
|
713
|
-
|
|
694
|
+
dialogTitle ? /* @__PURE__ */ React3.createElement(
|
|
695
|
+
Text2,
|
|
696
|
+
{
|
|
697
|
+
style: [
|
|
698
|
+
styles.dialogTitle,
|
|
699
|
+
{ color: theme.colors.foreground }
|
|
700
|
+
]
|
|
701
|
+
},
|
|
702
|
+
dialogTitle
|
|
703
|
+
) : null,
|
|
704
|
+
/* @__PURE__ */ React3.createElement(ScrollView, { style: { maxHeight: dialogMaxHeight } }, listItems)
|
|
705
|
+
))
|
|
714
706
|
)
|
|
715
707
|
))
|
|
716
708
|
));
|
|
@@ -761,7 +753,7 @@ var useSelectItemBackgroundColor = (themeColor, isSelected) => {
|
|
|
761
753
|
const colorScheme = theme.colors[safeThemeColor];
|
|
762
754
|
return useMemo3(() => {
|
|
763
755
|
if (isSelected) {
|
|
764
|
-
return colorScheme.
|
|
756
|
+
return colorScheme.container;
|
|
765
757
|
}
|
|
766
758
|
return "transparent";
|
|
767
759
|
}, [isSelected, colorScheme]);
|