@xaui/native 0.2.7 → 0.9.1-alpha.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/dist/chunk-JDS6KGCM.cjs +791 -0
- package/dist/chunk-T3ZI2PZ6.js +791 -0
- package/dist/index.cjs +32 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -0
- package/dist/theme/index.cjs +32 -0
- package/dist/theme/index.d.cts +669 -0
- package/dist/theme/index.d.ts +669 -0
- package/dist/theme/index.js +32 -0
- package/package.json +26 -249
- package/README.md +0 -178
- package/dist/alert/index.cjs +0 -356
- package/dist/alert/index.d.cts +0 -90
- package/dist/alert/index.d.ts +0 -90
- package/dist/alert/index.js +0 -356
- package/dist/app-bar/index.cjs +0 -148
- package/dist/app-bar/index.d.cts +0 -59
- package/dist/app-bar/index.d.ts +0 -59
- package/dist/app-bar/index.js +0 -148
- package/dist/autocomplete/index.cjs +0 -1122
- package/dist/autocomplete/index.d.cts +0 -88
- package/dist/autocomplete/index.d.ts +0 -88
- package/dist/autocomplete/index.js +0 -1122
- package/dist/avatar/index.cjs +0 -281
- package/dist/avatar/index.d.cts +0 -123
- package/dist/avatar/index.d.ts +0 -123
- package/dist/avatar/index.js +0 -281
- package/dist/badge/index.cjs +0 -197
- package/dist/badge/index.d.cts +0 -94
- package/dist/badge/index.d.ts +0 -94
- package/dist/badge/index.js +0 -197
- package/dist/bottom-sheet/index.cjs +0 -9
- package/dist/bottom-sheet/index.d.cts +0 -84
- package/dist/bottom-sheet/index.d.ts +0 -84
- package/dist/bottom-sheet/index.js +0 -9
- package/dist/bottom-tab-bar/index.cjs +0 -497
- package/dist/bottom-tab-bar/index.d.cts +0 -211
- package/dist/bottom-tab-bar/index.d.ts +0 -211
- package/dist/bottom-tab-bar/index.js +0 -497
- package/dist/button/index.cjs +0 -392
- package/dist/button/index.d.cts +0 -174
- package/dist/button/index.d.ts +0 -174
- package/dist/button/index.js +0 -392
- package/dist/button.type-j1ZdkkSl.d.cts +0 -4
- package/dist/button.type-j1ZdkkSl.d.ts +0 -4
- package/dist/card/index.cjs +0 -338
- package/dist/card/index.d.cts +0 -191
- package/dist/card/index.d.ts +0 -191
- package/dist/card/index.js +0 -338
- package/dist/carousel/index.cjs +0 -381
- package/dist/carousel/index.d.cts +0 -147
- package/dist/carousel/index.d.ts +0 -147
- package/dist/carousel/index.js +0 -381
- package/dist/chart/index.cjs +0 -1026
- package/dist/chart/index.d.cts +0 -218
- package/dist/chart/index.d.ts +0 -218
- package/dist/chart/index.js +0 -1026
- package/dist/checkbox/index.cjs +0 -443
- package/dist/checkbox/index.d.cts +0 -73
- package/dist/checkbox/index.d.ts +0 -73
- package/dist/checkbox/index.js +0 -443
- package/dist/chip/index.cjs +0 -503
- package/dist/chip/index.d.cts +0 -195
- package/dist/chip/index.d.ts +0 -195
- package/dist/chip/index.js +0 -503
- package/dist/chunk-4JFWQ5XT.js +0 -368
- package/dist/chunk-56RPWZD2.cjs +0 -9
- package/dist/chunk-7UFBLUMV.cjs +0 -136
- package/dist/chunk-A45TVXU5.js +0 -337
- package/dist/chunk-BYWUAPC4.cjs +0 -368
- package/dist/chunk-DECMUMCI.js +0 -0
- package/dist/chunk-DHSTKO3K.cjs +0 -19
- package/dist/chunk-DJ4Q37UT.cjs +0 -75
- package/dist/chunk-EUQDGTST.cjs +0 -1
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-RBSA4NH4.js +0 -136
- package/dist/chunk-SHBDANQN.js +0 -9
- package/dist/chunk-UGEINZM7.cjs +0 -290
- package/dist/chunk-UU4HHBDN.js +0 -290
- package/dist/chunk-VSZEXOUN.js +0 -384
- package/dist/chunk-YIEUN3G5.cjs +0 -384
- package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
- package/dist/chunk-ZY7IUTAT.js +0 -75
- package/dist/color-picker/index.cjs +0 -457
- package/dist/color-picker/index.d.cts +0 -124
- package/dist/color-picker/index.d.ts +0 -124
- package/dist/color-picker/index.js +0 -457
- package/dist/core/index.cjs +0 -24
- package/dist/core/index.d.cts +0 -28
- package/dist/core/index.d.ts +0 -28
- package/dist/core/index.js +0 -24
- package/dist/datepicker/index.cjs +0 -1625
- package/dist/datepicker/index.d.cts +0 -45
- package/dist/datepicker/index.d.ts +0 -45
- package/dist/datepicker/index.js +0 -1625
- package/dist/dialog/index.cjs +0 -372
- package/dist/dialog/index.d.cts +0 -151
- package/dist/dialog/index.d.ts +0 -151
- package/dist/dialog/index.js +0 -372
- package/dist/divider/index.cjs +0 -8
- package/dist/divider/index.d.cts +0 -30
- package/dist/divider/index.d.ts +0 -30
- package/dist/divider/index.js +0 -8
- package/dist/drawer/index.cjs +0 -237
- package/dist/drawer/index.d.cts +0 -58
- package/dist/drawer/index.d.ts +0 -58
- package/dist/drawer/index.js +0 -237
- package/dist/expansion-panel/index.cjs +0 -441
- package/dist/expansion-panel/index.d.cts +0 -153
- package/dist/expansion-panel/index.d.ts +0 -153
- package/dist/expansion-panel/index.js +0 -441
- package/dist/fab/index.cjs +0 -9
- package/dist/fab/index.d.cts +0 -10
- package/dist/fab/index.d.ts +0 -10
- package/dist/fab/index.js +0 -9
- package/dist/fab-menu/index.cjs +0 -330
- package/dist/fab-menu/index.d.cts +0 -125
- package/dist/fab-menu/index.d.ts +0 -125
- package/dist/fab-menu/index.js +0 -330
- package/dist/fab.type-CkUHmXU_.d.ts +0 -86
- package/dist/fab.type-DN0vtAh6.d.cts +0 -86
- package/dist/feature-discovery/index.cjs +0 -464
- package/dist/feature-discovery/index.d.cts +0 -82
- package/dist/feature-discovery/index.d.ts +0 -82
- package/dist/feature-discovery/index.js +0 -464
- package/dist/indicator/index.cjs +0 -8
- package/dist/indicator/index.d.cts +0 -47
- package/dist/indicator/index.d.ts +0 -47
- package/dist/indicator/index.js +0 -8
- package/dist/input/index.cjs +0 -1462
- package/dist/input/index.d.cts +0 -522
- package/dist/input/index.d.ts +0 -522
- package/dist/input/index.js +0 -1462
- package/dist/input-trigger/index.cjs +0 -197
- package/dist/input-trigger/index.d.cts +0 -11
- package/dist/input-trigger/index.d.ts +0 -11
- package/dist/input-trigger/index.js +0 -197
- package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
- package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
- package/dist/list/index.cjs +0 -395
- package/dist/list/index.d.cts +0 -188
- package/dist/list/index.d.ts +0 -188
- package/dist/list/index.js +0 -395
- package/dist/menu/index.cjs +0 -316
- package/dist/menu/index.d.cts +0 -115
- package/dist/menu/index.d.ts +0 -115
- package/dist/menu/index.js +0 -316
- package/dist/menubox/index.cjs +0 -297
- package/dist/menubox/index.d.cts +0 -98
- package/dist/menubox/index.d.ts +0 -98
- package/dist/menubox/index.js +0 -297
- package/dist/pager/index.cjs +0 -205
- package/dist/pager/index.d.cts +0 -93
- package/dist/pager/index.d.ts +0 -93
- package/dist/pager/index.js +0 -205
- package/dist/picker/index.cjs +0 -244
- package/dist/picker/index.d.cts +0 -121
- package/dist/picker/index.d.ts +0 -121
- package/dist/picker/index.js +0 -244
- package/dist/progress/index.cjs +0 -219
- package/dist/progress/index.d.cts +0 -47
- package/dist/progress/index.d.ts +0 -47
- package/dist/progress/index.js +0 -219
- package/dist/radio/index.cjs +0 -465
- package/dist/radio/index.d.cts +0 -145
- package/dist/radio/index.d.ts +0 -145
- package/dist/radio/index.js +0 -465
- package/dist/refresh-control/index.cjs +0 -45
- package/dist/refresh-control/index.d.cts +0 -55
- package/dist/refresh-control/index.d.ts +0 -55
- package/dist/refresh-control/index.js +0 -45
- package/dist/segment-button/index.cjs +0 -405
- package/dist/segment-button/index.d.cts +0 -141
- package/dist/segment-button/index.d.ts +0 -141
- package/dist/segment-button/index.js +0 -405
- package/dist/select/index.cjs +0 -878
- package/dist/select/index.d.cts +0 -192
- package/dist/select/index.d.ts +0 -192
- package/dist/select/index.js +0 -878
- package/dist/skeleton/index.cjs +0 -89
- package/dist/skeleton/index.d.cts +0 -45
- package/dist/skeleton/index.d.ts +0 -45
- package/dist/skeleton/index.js +0 -89
- package/dist/slider/index.cjs +0 -576
- package/dist/slider/index.d.cts +0 -171
- package/dist/slider/index.d.ts +0 -171
- package/dist/slider/index.js +0 -576
- package/dist/snackbar/index.cjs +0 -436
- package/dist/snackbar/index.d.cts +0 -174
- package/dist/snackbar/index.d.ts +0 -174
- package/dist/snackbar/index.js +0 -436
- package/dist/snippet/index.cjs +0 -314
- package/dist/snippet/index.d.cts +0 -95
- package/dist/snippet/index.d.ts +0 -95
- package/dist/snippet/index.js +0 -314
- package/dist/stepper/index.cjs +0 -550
- package/dist/stepper/index.d.cts +0 -137
- package/dist/stepper/index.d.ts +0 -137
- package/dist/stepper/index.js +0 -550
- package/dist/switch/index.cjs +0 -358
- package/dist/switch/index.d.cts +0 -28
- package/dist/switch/index.d.ts +0 -28
- package/dist/switch/index.js +0 -358
- package/dist/tabs/index.cjs +0 -440
- package/dist/tabs/index.d.cts +0 -180
- package/dist/tabs/index.d.ts +0 -180
- package/dist/tabs/index.js +0 -440
- package/dist/timepicker/index.cjs +0 -823
- package/dist/timepicker/index.d.cts +0 -215
- package/dist/timepicker/index.d.ts +0 -215
- package/dist/timepicker/index.js +0 -823
- package/dist/toolbar/index.cjs +0 -333
- package/dist/toolbar/index.d.cts +0 -100
- package/dist/toolbar/index.d.ts +0 -100
- package/dist/toolbar/index.js +0 -333
- package/dist/typography/index.cjs +0 -238
- package/dist/typography/index.d.cts +0 -113
- package/dist/typography/index.d.ts +0 -113
- package/dist/typography/index.js +0 -238
- package/dist/view/index.cjs +0 -1361
- package/dist/view/index.d.cts +0 -833
- package/dist/view/index.d.ts +0 -833
- package/dist/view/index.js +0 -1361
package/dist/select/index.cjs
DELETED
|
@@ -1,878 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
var _chunkDHSTKO3Kcjs = require('../chunk-DHSTKO3K.cjs');
|
|
4
|
-
require('../chunk-56RPWZD2.cjs');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
|
|
8
|
-
|
|
9
|
-
// src/components/select/select.tsx
|
|
10
|
-
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _reactnative = require('react-native');
|
|
20
|
-
|
|
21
|
-
// src/components/select/select-context.ts
|
|
22
|
-
|
|
23
|
-
var SelectContext = _react.createContext.call(void 0, null);
|
|
24
|
-
|
|
25
|
-
// src/components/select/select.hook.ts
|
|
26
|
-
|
|
27
|
-
var _core = require('@xaui/core');
|
|
28
|
-
var _palette = require('@xaui/core/palette');
|
|
29
|
-
var useSelectColorScheme = (themeColor) => {
|
|
30
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
31
|
-
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
32
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
33
|
-
return { theme, colorScheme };
|
|
34
|
-
};
|
|
35
|
-
var useSelectSizeStyles = (size) => {
|
|
36
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
37
|
-
return _react.useMemo.call(void 0, () => {
|
|
38
|
-
const sizes = {
|
|
39
|
-
xs: {
|
|
40
|
-
minHeight: theme.componentSizes.xs,
|
|
41
|
-
paddingHorizontal: theme.spacing.sm,
|
|
42
|
-
paddingVertical: theme.spacing.xs,
|
|
43
|
-
fontSize: theme.fontSizes.xs,
|
|
44
|
-
labelSize: theme.fontSizes.xs
|
|
45
|
-
},
|
|
46
|
-
sm: {
|
|
47
|
-
minHeight: theme.componentSizes.sm,
|
|
48
|
-
paddingHorizontal: theme.spacing.md,
|
|
49
|
-
paddingVertical: theme.spacing.xs,
|
|
50
|
-
fontSize: theme.fontSizes.sm,
|
|
51
|
-
labelSize: theme.fontSizes.xs
|
|
52
|
-
},
|
|
53
|
-
md: {
|
|
54
|
-
minHeight: theme.componentSizes.md,
|
|
55
|
-
paddingHorizontal: theme.spacing.md,
|
|
56
|
-
paddingVertical: theme.spacing.sm,
|
|
57
|
-
fontSize: theme.fontSizes.md,
|
|
58
|
-
labelSize: theme.fontSizes.sm
|
|
59
|
-
},
|
|
60
|
-
lg: {
|
|
61
|
-
minHeight: theme.componentSizes.lg,
|
|
62
|
-
paddingHorizontal: theme.spacing.lg,
|
|
63
|
-
paddingVertical: theme.spacing.md,
|
|
64
|
-
fontSize: theme.fontSizes.lg,
|
|
65
|
-
labelSize: theme.fontSizes.md
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
return sizes[size];
|
|
69
|
-
}, [size, theme]);
|
|
70
|
-
};
|
|
71
|
-
var useSelectRadiusStyles = (radius) => {
|
|
72
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
73
|
-
const radiusStyles = _react.useMemo.call(void 0, () => {
|
|
74
|
-
const radii = {
|
|
75
|
-
none: theme.borderRadius.none,
|
|
76
|
-
sm: theme.borderRadius.sm,
|
|
77
|
-
md: theme.borderRadius.md,
|
|
78
|
-
lg: theme.borderRadius.lg,
|
|
79
|
-
full: theme.borderRadius.full
|
|
80
|
-
};
|
|
81
|
-
return { borderRadius: radii[radius] };
|
|
82
|
-
}, [radius, theme]);
|
|
83
|
-
const listboxRadius = _react.useMemo.call(void 0, () => {
|
|
84
|
-
const radii = {
|
|
85
|
-
none: theme.borderRadius.none,
|
|
86
|
-
sm: theme.borderRadius.sm,
|
|
87
|
-
md: theme.borderRadius.md,
|
|
88
|
-
lg: theme.borderRadius.lg,
|
|
89
|
-
full: theme.borderRadius.full
|
|
90
|
-
};
|
|
91
|
-
return Math.min(radii[radius], theme.borderRadius.lg);
|
|
92
|
-
}, [radius, theme]);
|
|
93
|
-
return { radiusStyles, listboxRadius };
|
|
94
|
-
};
|
|
95
|
-
var useSelectVariantStyles = (themeColor, variant, isInvalid) => {
|
|
96
|
-
const { theme, colorScheme } = useSelectColorScheme(themeColor);
|
|
97
|
-
return _react.useMemo.call(void 0, () => {
|
|
98
|
-
let borderColor = isInvalid ? theme.colors.danger.main : colorScheme.main;
|
|
99
|
-
if (variant === "bordered" && themeColor === "default") {
|
|
100
|
-
borderColor = _palette.colors.gray[300];
|
|
101
|
-
}
|
|
102
|
-
const styles3 = {
|
|
103
|
-
bordered: {
|
|
104
|
-
backgroundColor: "transparent",
|
|
105
|
-
borderWidth: theme.borderWidth.md,
|
|
106
|
-
borderColor
|
|
107
|
-
},
|
|
108
|
-
colored: {
|
|
109
|
-
backgroundColor: _core.withOpacity.call(void 0, colorScheme.container, 0.5),
|
|
110
|
-
borderWidth: 0
|
|
111
|
-
},
|
|
112
|
-
light: {
|
|
113
|
-
backgroundColor: "transparent",
|
|
114
|
-
borderWidth: 0
|
|
115
|
-
},
|
|
116
|
-
underlined: {
|
|
117
|
-
backgroundColor: "transparent",
|
|
118
|
-
borderBottomWidth: theme.borderWidth.md,
|
|
119
|
-
borderColor
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
return styles3[variant];
|
|
123
|
-
}, [variant, theme, colorScheme, isInvalid, themeColor]);
|
|
124
|
-
};
|
|
125
|
-
var useSelectLabelStyle = (themeColor, isInvalid, labelSize) => {
|
|
126
|
-
const { theme, colorScheme } = useSelectColorScheme(themeColor);
|
|
127
|
-
return _react.useMemo.call(void 0, () => {
|
|
128
|
-
let baseColor = theme.colors.foreground;
|
|
129
|
-
if (isInvalid) {
|
|
130
|
-
baseColor = theme.colors.danger.main;
|
|
131
|
-
} else if (themeColor !== "default") {
|
|
132
|
-
baseColor = colorScheme.main;
|
|
133
|
-
}
|
|
134
|
-
return {
|
|
135
|
-
fontSize: labelSize,
|
|
136
|
-
color: baseColor
|
|
137
|
-
};
|
|
138
|
-
}, [isInvalid, labelSize, theme, themeColor, colorScheme]);
|
|
139
|
-
};
|
|
140
|
-
var useSelectValueColor = (isInvalid, shouldShowPlaceholder) => {
|
|
141
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
142
|
-
return _react.useMemo.call(void 0, () => {
|
|
143
|
-
if (isInvalid) {
|
|
144
|
-
return theme.colors.danger.main;
|
|
145
|
-
}
|
|
146
|
-
if (shouldShowPlaceholder) {
|
|
147
|
-
return _palette.colors.gray[500];
|
|
148
|
-
}
|
|
149
|
-
return theme.colors.foreground;
|
|
150
|
-
}, [isInvalid, shouldShowPlaceholder, theme]);
|
|
151
|
-
};
|
|
152
|
-
var useSelectHelperColor = (isInvalid) => {
|
|
153
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
154
|
-
return _react.useMemo.call(void 0, () => {
|
|
155
|
-
if (isInvalid) {
|
|
156
|
-
return theme.colors.danger.main;
|
|
157
|
-
}
|
|
158
|
-
return _palette.colors.gray[600];
|
|
159
|
-
}, [isInvalid, theme]);
|
|
160
|
-
};
|
|
161
|
-
var useSelectSelectorColor = (isInvalid, shouldShowPlaceholder) => {
|
|
162
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
163
|
-
return _react.useMemo.call(void 0, () => {
|
|
164
|
-
if (isInvalid) {
|
|
165
|
-
return theme.colors.danger.main;
|
|
166
|
-
}
|
|
167
|
-
if (shouldShowPlaceholder) {
|
|
168
|
-
return _palette.colors.gray[600];
|
|
169
|
-
}
|
|
170
|
-
return theme.colors.foreground;
|
|
171
|
-
}, [isInvalid, shouldShowPlaceholder, theme]);
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
// src/components/select/select.style.ts
|
|
175
|
-
|
|
176
|
-
var styles = _reactnative.StyleSheet.create({
|
|
177
|
-
container: {
|
|
178
|
-
gap: 6
|
|
179
|
-
},
|
|
180
|
-
fullWidth: {
|
|
181
|
-
flexShrink: 1,
|
|
182
|
-
flexBasis: "auto",
|
|
183
|
-
width: "100%"
|
|
184
|
-
},
|
|
185
|
-
minWidth: {
|
|
186
|
-
minWidth: 170
|
|
187
|
-
},
|
|
188
|
-
label: {
|
|
189
|
-
fontWeight: "500"
|
|
190
|
-
},
|
|
191
|
-
trigger: {
|
|
192
|
-
flexDirection: "row",
|
|
193
|
-
alignItems: "center",
|
|
194
|
-
justifyContent: "space-between",
|
|
195
|
-
gap: 8
|
|
196
|
-
},
|
|
197
|
-
triggerContent: {
|
|
198
|
-
flexDirection: "row",
|
|
199
|
-
alignItems: "center",
|
|
200
|
-
flex: 1,
|
|
201
|
-
gap: 8
|
|
202
|
-
},
|
|
203
|
-
triggerContentColumn: {
|
|
204
|
-
flexDirection: "column",
|
|
205
|
-
alignItems: "flex-start"
|
|
206
|
-
},
|
|
207
|
-
valueWrapper: {
|
|
208
|
-
flex: 1,
|
|
209
|
-
gap: 2
|
|
210
|
-
},
|
|
211
|
-
valueText: {
|
|
212
|
-
flexShrink: 1
|
|
213
|
-
},
|
|
214
|
-
endSlot: {
|
|
215
|
-
flexDirection: "row",
|
|
216
|
-
alignItems: "center",
|
|
217
|
-
gap: 8
|
|
218
|
-
},
|
|
219
|
-
clearButton: {
|
|
220
|
-
paddingHorizontal: 4,
|
|
221
|
-
paddingVertical: 2
|
|
222
|
-
},
|
|
223
|
-
clearText: {
|
|
224
|
-
fontSize: 12
|
|
225
|
-
},
|
|
226
|
-
helperText: {
|
|
227
|
-
fontSize: 12
|
|
228
|
-
},
|
|
229
|
-
disabled: {
|
|
230
|
-
opacity: 0.5
|
|
231
|
-
},
|
|
232
|
-
overlay: {
|
|
233
|
-
flex: 1,
|
|
234
|
-
backgroundColor: "rgba(0, 0, 0, 0.70)",
|
|
235
|
-
justifyContent: "center",
|
|
236
|
-
alignItems: "center"
|
|
237
|
-
},
|
|
238
|
-
listbox: {
|
|
239
|
-
overflow: "hidden"
|
|
240
|
-
},
|
|
241
|
-
listboxContent: {
|
|
242
|
-
minWidth: "100%"
|
|
243
|
-
},
|
|
244
|
-
dialogTitle: {
|
|
245
|
-
fontWeight: "600",
|
|
246
|
-
paddingHorizontal: 16,
|
|
247
|
-
paddingVertical: 12
|
|
248
|
-
},
|
|
249
|
-
outsideLeftRow: {
|
|
250
|
-
flexDirection: "row",
|
|
251
|
-
alignItems: "center",
|
|
252
|
-
gap: 12
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
// src/components/select/select-trigger.tsx
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
// src/components/select/chevron-down-icon.tsx
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
var _reactnativesvg = require('react-native-svg'); var _reactnativesvg2 = _interopRequireDefault(_reactnativesvg);
|
|
268
|
-
function ChevronDownIcon({
|
|
269
|
-
color,
|
|
270
|
-
size,
|
|
271
|
-
isOpen = false
|
|
272
|
-
}) {
|
|
273
|
-
const rotation = _react.useRef.call(void 0, new _reactnative.Animated.Value(isOpen ? 1 : 0)).current;
|
|
274
|
-
_react.useEffect.call(void 0, () => {
|
|
275
|
-
_reactnative.Animated.timing(rotation, {
|
|
276
|
-
toValue: isOpen ? 1 : 0,
|
|
277
|
-
duration: 180,
|
|
278
|
-
useNativeDriver: true
|
|
279
|
-
}).start();
|
|
280
|
-
}, [isOpen, rotation]);
|
|
281
|
-
const rotate = rotation.interpolate({
|
|
282
|
-
inputRange: [0, 1],
|
|
283
|
-
outputRange: ["0deg", "180deg"]
|
|
284
|
-
});
|
|
285
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: { transform: [{ rotate }] } }, /* @__PURE__ */ _react2.default.createElement(_reactnativesvg2.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ _react2.default.createElement(
|
|
286
|
-
_reactnativesvg.Path,
|
|
287
|
-
{
|
|
288
|
-
d: "M6 9L12 15L18 9",
|
|
289
|
-
stroke: color,
|
|
290
|
-
strokeWidth: 2,
|
|
291
|
-
strokeLinecap: "round",
|
|
292
|
-
strokeLinejoin: "round"
|
|
293
|
-
}
|
|
294
|
-
)));
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
// src/components/select/select-trigger.tsx
|
|
298
|
-
var SelectTrigger = ({
|
|
299
|
-
triggerRef,
|
|
300
|
-
isOpen,
|
|
301
|
-
isDisabled,
|
|
302
|
-
onPress,
|
|
303
|
-
onLayout,
|
|
304
|
-
accessibilityLabel,
|
|
305
|
-
variant,
|
|
306
|
-
sizeStyles,
|
|
307
|
-
radiusStyles,
|
|
308
|
-
variantStyles,
|
|
309
|
-
displayValue,
|
|
310
|
-
valueColor,
|
|
311
|
-
selectorColor,
|
|
312
|
-
labelInside,
|
|
313
|
-
labelNode,
|
|
314
|
-
startContent,
|
|
315
|
-
endContent,
|
|
316
|
-
selectorIcon,
|
|
317
|
-
onClear,
|
|
318
|
-
showClear,
|
|
319
|
-
textStyle,
|
|
320
|
-
style
|
|
321
|
-
}) => {
|
|
322
|
-
const renderSelectorIcon = _nullishCoalesce(selectorIcon, () => ( /* @__PURE__ */ _react2.default.createElement(ChevronDownIcon, { color: selectorColor, size: 16, isOpen })));
|
|
323
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { ref: triggerRef, collapsable: false }, /* @__PURE__ */ _react2.default.createElement(
|
|
324
|
-
_reactnative.Pressable,
|
|
325
|
-
{
|
|
326
|
-
onPress,
|
|
327
|
-
disabled: isDisabled,
|
|
328
|
-
onLayout,
|
|
329
|
-
accessibilityRole: "button",
|
|
330
|
-
accessibilityLabel,
|
|
331
|
-
accessibilityState: { disabled: isDisabled, expanded: isOpen },
|
|
332
|
-
style: [
|
|
333
|
-
styles.trigger,
|
|
334
|
-
variant === "underlined" ? { borderRadius: 0 } : radiusStyles,
|
|
335
|
-
variantStyles,
|
|
336
|
-
{
|
|
337
|
-
minHeight: sizeStyles.minHeight,
|
|
338
|
-
paddingHorizontal: variant === "underlined" ? 2 : sizeStyles.paddingHorizontal,
|
|
339
|
-
paddingVertical: sizeStyles.paddingVertical
|
|
340
|
-
},
|
|
341
|
-
isDisabled && styles.disabled,
|
|
342
|
-
style
|
|
343
|
-
]
|
|
344
|
-
},
|
|
345
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
346
|
-
_reactnative.View,
|
|
347
|
-
{
|
|
348
|
-
style: [styles.triggerContent, labelInside && styles.triggerContentColumn]
|
|
349
|
-
},
|
|
350
|
-
startContent,
|
|
351
|
-
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.valueWrapper }, labelInside && labelNode, /* @__PURE__ */ _react2.default.createElement(
|
|
352
|
-
_reactnative.Text,
|
|
353
|
-
{
|
|
354
|
-
style: [
|
|
355
|
-
styles.valueText,
|
|
356
|
-
{ fontSize: sizeStyles.fontSize, color: valueColor },
|
|
357
|
-
textStyle
|
|
358
|
-
]
|
|
359
|
-
},
|
|
360
|
-
displayValue
|
|
361
|
-
)),
|
|
362
|
-
endContent
|
|
363
|
-
),
|
|
364
|
-
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.endSlot }, showClear && onClear && /* @__PURE__ */ _react2.default.createElement(_reactnative.Pressable, { onPress: onClear, style: styles.clearButton }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.clearText, { color: selectorColor }] }, "x")), renderSelectorIcon)
|
|
365
|
-
));
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
// src/components/select/select.animation.ts
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
var useSelectListboxAnimation = (isOpen) => {
|
|
372
|
-
const animationOpacity = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
373
|
-
const animationScale = _react.useRef.call(void 0, new _reactnative.Animated.Value(0.98)).current;
|
|
374
|
-
_react.useEffect.call(void 0, () => {
|
|
375
|
-
if (!isOpen) {
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
animationOpacity.setValue(0);
|
|
379
|
-
animationScale.setValue(0.98);
|
|
380
|
-
_reactnative.Animated.parallel([
|
|
381
|
-
_reactnative.Animated.timing(animationOpacity, {
|
|
382
|
-
toValue: 1,
|
|
383
|
-
duration: 180,
|
|
384
|
-
useNativeDriver: true
|
|
385
|
-
}),
|
|
386
|
-
_reactnative.Animated.timing(animationScale, {
|
|
387
|
-
toValue: 1,
|
|
388
|
-
duration: 180,
|
|
389
|
-
useNativeDriver: true
|
|
390
|
-
})
|
|
391
|
-
]).start();
|
|
392
|
-
}, [isOpen, animationOpacity, animationScale]);
|
|
393
|
-
return { animationOpacity, animationScale };
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
// src/components/select/select.state.hook.ts
|
|
397
|
-
|
|
398
|
-
var useSelectOpenState = ({
|
|
399
|
-
isOpened,
|
|
400
|
-
isDisabled,
|
|
401
|
-
onOpenChange,
|
|
402
|
-
onClose
|
|
403
|
-
}) => {
|
|
404
|
-
const [internalOpen, setInternalOpen] = _react.useState.call(void 0, false);
|
|
405
|
-
const isOpen = _nullishCoalesce(isOpened, () => ( internalOpen));
|
|
406
|
-
const setOpen = _react.useCallback.call(void 0,
|
|
407
|
-
(nextOpen) => {
|
|
408
|
-
if (nextOpen && isDisabled) {
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
if (isOpened === void 0) {
|
|
412
|
-
setInternalOpen(nextOpen);
|
|
413
|
-
}
|
|
414
|
-
_optionalChain([onOpenChange, 'optionalCall', _ => _(nextOpen)]);
|
|
415
|
-
if (!nextOpen) {
|
|
416
|
-
_optionalChain([onClose, 'optionalCall', _2 => _2()]);
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
[isDisabled, isOpened, onOpenChange, onClose]
|
|
420
|
-
);
|
|
421
|
-
return { isOpen, setOpen };
|
|
422
|
-
};
|
|
423
|
-
var useSelectSelection = ({
|
|
424
|
-
selectionMode,
|
|
425
|
-
selectedKeys,
|
|
426
|
-
defaultSelectedKeys,
|
|
427
|
-
onSelectionChange,
|
|
428
|
-
onClear
|
|
429
|
-
}) => {
|
|
430
|
-
const [internalSelectedKeys, setInternalSelectedKeys] = _react.useState.call(void 0,
|
|
431
|
-
_nullishCoalesce(defaultSelectedKeys, () => ( []))
|
|
432
|
-
);
|
|
433
|
-
const isControlledSelection = selectedKeys !== void 0;
|
|
434
|
-
const currentSelectedKeys = isControlledSelection ? _nullishCoalesce(selectedKeys, () => ( [])) : internalSelectedKeys;
|
|
435
|
-
const updateSelection = _react.useCallback.call(void 0,
|
|
436
|
-
(nextKeys) => {
|
|
437
|
-
if (!isControlledSelection) {
|
|
438
|
-
setInternalSelectedKeys(nextKeys);
|
|
439
|
-
}
|
|
440
|
-
_optionalChain([onSelectionChange, 'optionalCall', _3 => _3(nextKeys)]);
|
|
441
|
-
if (nextKeys.length === 0) {
|
|
442
|
-
_optionalChain([onClear, 'optionalCall', _4 => _4()]);
|
|
443
|
-
}
|
|
444
|
-
},
|
|
445
|
-
[isControlledSelection, onSelectionChange, onClear]
|
|
446
|
-
);
|
|
447
|
-
const getNextSelection = _react.useCallback.call(void 0,
|
|
448
|
-
(key) => {
|
|
449
|
-
const isAlreadySelected = currentSelectedKeys.includes(key);
|
|
450
|
-
if (selectionMode === "multiple") {
|
|
451
|
-
return isAlreadySelected ? currentSelectedKeys.filter((existingKey) => existingKey !== key) : [...currentSelectedKeys, key];
|
|
452
|
-
}
|
|
453
|
-
if (!isAlreadySelected) {
|
|
454
|
-
return [key];
|
|
455
|
-
}
|
|
456
|
-
return currentSelectedKeys;
|
|
457
|
-
},
|
|
458
|
-
[currentSelectedKeys, selectionMode]
|
|
459
|
-
);
|
|
460
|
-
return { currentSelectedKeys, updateSelection, getNextSelection };
|
|
461
|
-
};
|
|
462
|
-
var useSelectTriggerMeasurements = (isOpen) => {
|
|
463
|
-
const triggerRef = _react.useRef.call(void 0, null);
|
|
464
|
-
const [triggerWidth, setTriggerWidth] = _react.useState.call(void 0, null);
|
|
465
|
-
const [triggerPosition, setTriggerPosition] = _react.useState.call(void 0,
|
|
466
|
-
null
|
|
467
|
-
);
|
|
468
|
-
const handleTriggerLayout = _react.useCallback.call(void 0, (event) => {
|
|
469
|
-
setTriggerWidth(event.nativeEvent.layout.width);
|
|
470
|
-
}, []);
|
|
471
|
-
_react.useEffect.call(void 0, () => {
|
|
472
|
-
if (!isOpen) {
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
const measureTrigger = () => {
|
|
476
|
-
_optionalChain([triggerRef, 'access', _5 => _5.current, 'optionalAccess', _6 => _6.measureInWindow, 'call', _7 => _7((x, y, width, height) => {
|
|
477
|
-
setTriggerPosition({ x, y, width, height });
|
|
478
|
-
})]);
|
|
479
|
-
};
|
|
480
|
-
const frameId = globalThis.setTimeout(measureTrigger, 0);
|
|
481
|
-
return () => globalThis.clearTimeout(frameId);
|
|
482
|
-
}, [isOpen]);
|
|
483
|
-
return { triggerRef, triggerWidth, triggerPosition, handleTriggerLayout };
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
// src/components/select/select.utils.ts
|
|
487
|
-
var getTextValue = (value) => {
|
|
488
|
-
if (typeof value === "string") return value;
|
|
489
|
-
if (typeof value === "number") return String(value);
|
|
490
|
-
return void 0;
|
|
491
|
-
};
|
|
492
|
-
|
|
493
|
-
// src/components/select/select.tsx
|
|
494
|
-
var defaultPlaceholder = "Select an option";
|
|
495
|
-
var Select = ({
|
|
496
|
-
children,
|
|
497
|
-
selectionMode = "single",
|
|
498
|
-
selectedKeys,
|
|
499
|
-
disabledKeys,
|
|
500
|
-
defaultSelectedKeys,
|
|
501
|
-
variant = "colored",
|
|
502
|
-
themeColor = "default",
|
|
503
|
-
size = "md",
|
|
504
|
-
radius = "md",
|
|
505
|
-
placeholder = defaultPlaceholder,
|
|
506
|
-
labelPlacement = "outside",
|
|
507
|
-
label,
|
|
508
|
-
hint,
|
|
509
|
-
errorMessage,
|
|
510
|
-
startContent,
|
|
511
|
-
endContent,
|
|
512
|
-
selectorIcon,
|
|
513
|
-
maxListboxHeight = 280,
|
|
514
|
-
fullWidth = false,
|
|
515
|
-
isOpened,
|
|
516
|
-
isDisabled = false,
|
|
517
|
-
isInvalid = false,
|
|
518
|
-
style,
|
|
519
|
-
textStyle,
|
|
520
|
-
onClose,
|
|
521
|
-
onOpenChange,
|
|
522
|
-
onSelectionChange,
|
|
523
|
-
onClear
|
|
524
|
-
}) => {
|
|
525
|
-
const { isOpen, setOpen } = useSelectOpenState({
|
|
526
|
-
isOpened,
|
|
527
|
-
isDisabled,
|
|
528
|
-
onOpenChange,
|
|
529
|
-
onClose
|
|
530
|
-
});
|
|
531
|
-
const { currentSelectedKeys, updateSelection, getNextSelection } = useSelectSelection({
|
|
532
|
-
selectionMode,
|
|
533
|
-
selectedKeys,
|
|
534
|
-
defaultSelectedKeys,
|
|
535
|
-
onSelectionChange,
|
|
536
|
-
onClear
|
|
537
|
-
});
|
|
538
|
-
const { triggerRef, handleTriggerLayout } = useSelectTriggerMeasurements(isOpen);
|
|
539
|
-
const { animationOpacity, animationScale } = useSelectListboxAnimation(isOpen);
|
|
540
|
-
const { width: screenWidth, height: screenHeight } = _reactnative.useWindowDimensions.call(void 0, );
|
|
541
|
-
const disabledKeySet = _react.useMemo.call(void 0, () => {
|
|
542
|
-
return new Set(_nullishCoalesce(disabledKeys, () => ( [])));
|
|
543
|
-
}, [disabledKeys]);
|
|
544
|
-
const items = _react.useMemo.call(void 0, () => {
|
|
545
|
-
const elements = _react2.default.Children.toArray(children).filter(Boolean);
|
|
546
|
-
return elements.map((child, index) => {
|
|
547
|
-
if (!_react2.default.isValidElement(child)) {
|
|
548
|
-
return null;
|
|
549
|
-
}
|
|
550
|
-
const key = _nullishCoalesce(child.props.value, () => ( String(index)));
|
|
551
|
-
const labelText = _nullishCoalesce(getTextValue(child.props.label), () => ( key));
|
|
552
|
-
return {
|
|
553
|
-
key,
|
|
554
|
-
element: child,
|
|
555
|
-
labelText
|
|
556
|
-
};
|
|
557
|
-
}).filter((item) => item !== null);
|
|
558
|
-
}, [children]);
|
|
559
|
-
const selectedLabels = _react.useMemo.call(void 0, () => {
|
|
560
|
-
const labelMap = new Map(items.map((item) => [item.key, item.labelText]));
|
|
561
|
-
return currentSelectedKeys.map((key) => labelMap.get(key)).filter((value) => Boolean(value));
|
|
562
|
-
}, [currentSelectedKeys, items]);
|
|
563
|
-
const displayValue = selectedLabels.length ? selectedLabels.join(", ") : placeholder;
|
|
564
|
-
const shouldShowPlaceholder = selectedLabels.length === 0;
|
|
565
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
566
|
-
const sizeStyles = useSelectSizeStyles(size);
|
|
567
|
-
const { radiusStyles, listboxRadius } = useSelectRadiusStyles(radius);
|
|
568
|
-
const variantStyles = useSelectVariantStyles(themeColor, variant, isInvalid);
|
|
569
|
-
const labelStyle = useSelectLabelStyle(themeColor, isInvalid, sizeStyles.labelSize);
|
|
570
|
-
const valueColor = useSelectValueColor(isInvalid, shouldShowPlaceholder);
|
|
571
|
-
const helperColor = useSelectHelperColor(isInvalid);
|
|
572
|
-
const selectorColor = useSelectSelectorColor(isInvalid, shouldShowPlaceholder);
|
|
573
|
-
const handleItemSelection = _react.useCallback.call(void 0,
|
|
574
|
-
(key) => {
|
|
575
|
-
if (isDisabled) {
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
const nextKeys = getNextSelection(key);
|
|
579
|
-
if (nextKeys !== currentSelectedKeys) {
|
|
580
|
-
updateSelection(nextKeys);
|
|
581
|
-
}
|
|
582
|
-
if (selectionMode === "single") {
|
|
583
|
-
setOpen(false);
|
|
584
|
-
}
|
|
585
|
-
},
|
|
586
|
-
[
|
|
587
|
-
currentSelectedKeys,
|
|
588
|
-
isDisabled,
|
|
589
|
-
selectionMode,
|
|
590
|
-
setOpen,
|
|
591
|
-
updateSelection,
|
|
592
|
-
getNextSelection
|
|
593
|
-
]
|
|
594
|
-
);
|
|
595
|
-
const handleClear = () => {
|
|
596
|
-
if (isDisabled || currentSelectedKeys.length === 0) {
|
|
597
|
-
return;
|
|
598
|
-
}
|
|
599
|
-
updateSelection([]);
|
|
600
|
-
};
|
|
601
|
-
const handleOverlayPress = () => {
|
|
602
|
-
setOpen(false);
|
|
603
|
-
};
|
|
604
|
-
const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.label, labelStyle] }, label) : /* @__PURE__ */ _react2.default.createElement(_reactnative.View, null, label) : null;
|
|
605
|
-
const dialogTitle = typeof label === "string" || typeof label === "number" ? String(label) : void 0;
|
|
606
|
-
const shouldShowHelper = Boolean(hint || errorMessage);
|
|
607
|
-
const helperContent = isInvalid && errorMessage ? errorMessage : hint;
|
|
608
|
-
const dialogWidth = screenWidth * 0.9;
|
|
609
|
-
const dialogMaxHeight = Math.min(screenHeight * 0.6, maxListboxHeight);
|
|
610
|
-
const listItems = items.map((item) => {
|
|
611
|
-
const itemProps = item.element.props;
|
|
612
|
-
const itemDisabled = isDisabled || itemProps.isDisabled || disabledKeySet.has(item.key);
|
|
613
|
-
const itemSelected = _nullishCoalesce(itemProps.isSelected, () => ( currentSelectedKeys.includes(item.key)));
|
|
614
|
-
const handleItemSelected = () => {
|
|
615
|
-
if (itemDisabled || itemProps.isReadOnly) {
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
handleItemSelection(item.key);
|
|
619
|
-
_optionalChain([itemProps, 'access', _8 => _8.onSelected, 'optionalCall', _9 => _9()]);
|
|
620
|
-
};
|
|
621
|
-
return _react2.default.cloneElement(item.element, {
|
|
622
|
-
key: item.key,
|
|
623
|
-
isDisabled: itemDisabled,
|
|
624
|
-
isSelected: itemSelected,
|
|
625
|
-
onSelected: handleItemSelected
|
|
626
|
-
});
|
|
627
|
-
});
|
|
628
|
-
const isLabelInside = labelPlacement === "inside";
|
|
629
|
-
const isLabelOutsideLeft = labelPlacement === "outside-left";
|
|
630
|
-
const isLabelOutside = labelPlacement === "outside" || labelPlacement === "outside-top";
|
|
631
|
-
const triggerContent = /* @__PURE__ */ _react2.default.createElement(
|
|
632
|
-
SelectTrigger,
|
|
633
|
-
{
|
|
634
|
-
triggerRef,
|
|
635
|
-
isOpen,
|
|
636
|
-
isDisabled,
|
|
637
|
-
onPress: () => setOpen(!isOpen),
|
|
638
|
-
onLayout: handleTriggerLayout,
|
|
639
|
-
accessibilityLabel: typeof label === "string" ? label : void 0,
|
|
640
|
-
variant,
|
|
641
|
-
sizeStyles,
|
|
642
|
-
radiusStyles,
|
|
643
|
-
variantStyles,
|
|
644
|
-
displayValue,
|
|
645
|
-
valueColor,
|
|
646
|
-
selectorColor,
|
|
647
|
-
labelInside: isLabelInside,
|
|
648
|
-
labelNode: renderLabel,
|
|
649
|
-
startContent,
|
|
650
|
-
endContent,
|
|
651
|
-
selectorIcon,
|
|
652
|
-
onClear: handleClear,
|
|
653
|
-
showClear: Boolean(onClear && currentSelectedKeys.length > 0),
|
|
654
|
-
textStyle,
|
|
655
|
-
style
|
|
656
|
-
}
|
|
657
|
-
);
|
|
658
|
-
const labelBlock = isLabelOutside || isLabelInside ? renderLabel : null;
|
|
659
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.container, fullWidth ? styles.fullWidth : styles.minWidth] }, isLabelOutside && labelBlock, isLabelOutsideLeft ? /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.outsideLeftRow }, renderLabel, triggerContent) : triggerContent, shouldShowHelper && helperContent ? typeof helperContent === "string" || typeof helperContent === "number" ? /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.helperText, { color: helperColor }] }, helperContent) : /* @__PURE__ */ _react2.default.createElement(_reactnative.View, null, helperContent) : null, /* @__PURE__ */ _react2.default.createElement(
|
|
660
|
-
_reactnative.Modal,
|
|
661
|
-
{
|
|
662
|
-
visible: isOpen,
|
|
663
|
-
transparent: true,
|
|
664
|
-
animationType: "fade",
|
|
665
|
-
onRequestClose: handleOverlayPress
|
|
666
|
-
},
|
|
667
|
-
/* @__PURE__ */ _react2.default.createElement(_reactnative.Pressable, { style: styles.overlay, onPress: handleOverlayPress }, /* @__PURE__ */ _react2.default.createElement(
|
|
668
|
-
_reactnative.Animated.View,
|
|
669
|
-
{
|
|
670
|
-
style: [
|
|
671
|
-
styles.listbox,
|
|
672
|
-
{
|
|
673
|
-
width: dialogWidth,
|
|
674
|
-
maxHeight: dialogMaxHeight,
|
|
675
|
-
borderRadius: listboxRadius,
|
|
676
|
-
backgroundColor: theme.colors.background,
|
|
677
|
-
opacity: animationOpacity,
|
|
678
|
-
transform: [{ scale: animationScale }],
|
|
679
|
-
...theme.shadows.md
|
|
680
|
-
}
|
|
681
|
-
]
|
|
682
|
-
},
|
|
683
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
684
|
-
_reactnative.Pressable,
|
|
685
|
-
{
|
|
686
|
-
onPress: (event) => event.stopPropagation(),
|
|
687
|
-
style: { maxHeight: dialogMaxHeight }
|
|
688
|
-
},
|
|
689
|
-
/* @__PURE__ */ _react2.default.createElement(SelectContext.Provider, { value: { size, themeColor, isDisabled } }, /* @__PURE__ */ _react2.default.createElement(
|
|
690
|
-
_reactnative.View,
|
|
691
|
-
{
|
|
692
|
-
style: [styles.listboxContent, { maxHeight: dialogMaxHeight }]
|
|
693
|
-
},
|
|
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
|
-
))
|
|
706
|
-
)
|
|
707
|
-
))
|
|
708
|
-
));
|
|
709
|
-
};
|
|
710
|
-
|
|
711
|
-
// src/components/select/select-item.tsx
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
// src/components/select/select-item.hook.ts
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
var useSelectItemSizeStyles = (size) => {
|
|
719
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
720
|
-
return _react.useMemo.call(void 0, () => {
|
|
721
|
-
const sizes = {
|
|
722
|
-
xs: {
|
|
723
|
-
paddingVertical: theme.spacing.sm,
|
|
724
|
-
paddingHorizontal: theme.spacing.xs,
|
|
725
|
-
titleSize: theme.fontSizes.xs,
|
|
726
|
-
descriptionSize: theme.fontSizes.xs
|
|
727
|
-
},
|
|
728
|
-
sm: {
|
|
729
|
-
paddingVertical: theme.spacing.sm,
|
|
730
|
-
paddingHorizontal: theme.spacing.md,
|
|
731
|
-
titleSize: theme.fontSizes.sm,
|
|
732
|
-
descriptionSize: theme.fontSizes.xs
|
|
733
|
-
},
|
|
734
|
-
md: {
|
|
735
|
-
paddingVertical: theme.spacing.md,
|
|
736
|
-
paddingHorizontal: theme.spacing.md,
|
|
737
|
-
titleSize: theme.fontSizes.md,
|
|
738
|
-
descriptionSize: theme.fontSizes.xs
|
|
739
|
-
},
|
|
740
|
-
lg: {
|
|
741
|
-
paddingVertical: theme.spacing.lg,
|
|
742
|
-
paddingHorizontal: theme.spacing.lg,
|
|
743
|
-
titleSize: theme.fontSizes.lg,
|
|
744
|
-
descriptionSize: theme.fontSizes.md
|
|
745
|
-
}
|
|
746
|
-
};
|
|
747
|
-
return sizes[size];
|
|
748
|
-
}, [size, theme]);
|
|
749
|
-
};
|
|
750
|
-
var useSelectItemBackgroundColor = (themeColor, isSelected) => {
|
|
751
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
752
|
-
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
753
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
754
|
-
return _react.useMemo.call(void 0, () => {
|
|
755
|
-
if (isSelected) {
|
|
756
|
-
return colorScheme.container;
|
|
757
|
-
}
|
|
758
|
-
return "transparent";
|
|
759
|
-
}, [isSelected, colorScheme]);
|
|
760
|
-
};
|
|
761
|
-
var useSelectItemTextColors = () => {
|
|
762
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
763
|
-
return _react.useMemo.call(void 0, () => {
|
|
764
|
-
return {
|
|
765
|
-
textColor: theme.colors.foreground,
|
|
766
|
-
descriptionColor: theme.colors.foreground
|
|
767
|
-
};
|
|
768
|
-
}, [theme]);
|
|
769
|
-
};
|
|
770
|
-
var useSelectItemCheckmarkColor = (themeColor) => {
|
|
771
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
772
|
-
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
773
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
774
|
-
return _react.useMemo.call(void 0, () => {
|
|
775
|
-
if (themeColor === "default") {
|
|
776
|
-
return theme.colors.primary.main;
|
|
777
|
-
}
|
|
778
|
-
return colorScheme.main;
|
|
779
|
-
}, [themeColor, colorScheme, theme]);
|
|
780
|
-
};
|
|
781
|
-
|
|
782
|
-
// src/components/select/select-item.style.ts
|
|
783
|
-
|
|
784
|
-
var styles2 = _reactnative.StyleSheet.create({
|
|
785
|
-
item: {
|
|
786
|
-
flexDirection: "row",
|
|
787
|
-
alignItems: "center",
|
|
788
|
-
gap: 8
|
|
789
|
-
},
|
|
790
|
-
content: {
|
|
791
|
-
flex: 1,
|
|
792
|
-
gap: 2
|
|
793
|
-
},
|
|
794
|
-
title: {
|
|
795
|
-
fontWeight: "500"
|
|
796
|
-
},
|
|
797
|
-
description: {
|
|
798
|
-
opacity: 0.7
|
|
799
|
-
},
|
|
800
|
-
disabled: {
|
|
801
|
-
opacity: 0.5
|
|
802
|
-
}
|
|
803
|
-
});
|
|
804
|
-
|
|
805
|
-
// src/components/select/select-item.tsx
|
|
806
|
-
var defaultSize = "md";
|
|
807
|
-
var SelectItem = ({
|
|
808
|
-
label,
|
|
809
|
-
description,
|
|
810
|
-
startContent,
|
|
811
|
-
endContent,
|
|
812
|
-
selectedIcon,
|
|
813
|
-
isDisabled = false,
|
|
814
|
-
isSelected = false,
|
|
815
|
-
isReadOnly = false,
|
|
816
|
-
style,
|
|
817
|
-
textStyle,
|
|
818
|
-
onSelected
|
|
819
|
-
}) => {
|
|
820
|
-
const context = _react.useContext.call(void 0, SelectContext);
|
|
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;
|
|
824
|
-
const sizeStyles = useSelectItemSizeStyles(size);
|
|
825
|
-
const backgroundColor = useSelectItemBackgroundColor(themeColor, isSelected);
|
|
826
|
-
const { textColor, descriptionColor } = useSelectItemTextColors();
|
|
827
|
-
const checkmarkColor = useSelectItemCheckmarkColor(themeColor);
|
|
828
|
-
const handlePress = () => {
|
|
829
|
-
if (isItemDisabled || isReadOnly) {
|
|
830
|
-
return;
|
|
831
|
-
}
|
|
832
|
-
_optionalChain([onSelected, 'optionalCall', _13 => _13()]);
|
|
833
|
-
};
|
|
834
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
835
|
-
_reactnative.Pressable,
|
|
836
|
-
{
|
|
837
|
-
onPress: handlePress,
|
|
838
|
-
disabled: isItemDisabled,
|
|
839
|
-
style: [
|
|
840
|
-
styles2.item,
|
|
841
|
-
{
|
|
842
|
-
paddingVertical: sizeStyles.paddingVertical,
|
|
843
|
-
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
844
|
-
backgroundColor
|
|
845
|
-
},
|
|
846
|
-
isItemDisabled && styles2.disabled,
|
|
847
|
-
style
|
|
848
|
-
]
|
|
849
|
-
},
|
|
850
|
-
startContent,
|
|
851
|
-
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.content }, /* @__PURE__ */ _react2.default.createElement(
|
|
852
|
-
_reactnative.Text,
|
|
853
|
-
{
|
|
854
|
-
style: [
|
|
855
|
-
styles2.title,
|
|
856
|
-
{ fontSize: sizeStyles.titleSize, color: textColor },
|
|
857
|
-
textStyle
|
|
858
|
-
]
|
|
859
|
-
},
|
|
860
|
-
label
|
|
861
|
-
), description && /* @__PURE__ */ _react2.default.createElement(
|
|
862
|
-
_reactnative.Text,
|
|
863
|
-
{
|
|
864
|
-
style: [
|
|
865
|
-
styles2.description,
|
|
866
|
-
{ fontSize: sizeStyles.descriptionSize, color: descriptionColor }
|
|
867
|
-
]
|
|
868
|
-
},
|
|
869
|
-
description
|
|
870
|
-
)),
|
|
871
|
-
isSelected && (selectedIcon || /* @__PURE__ */ _react2.default.createElement(_chunkDHSTKO3Kcjs.CheckmarkIcon, { color: checkmarkColor, size: 16 })),
|
|
872
|
-
endContent
|
|
873
|
-
);
|
|
874
|
-
};
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
exports.Select = Select; exports.SelectItem = SelectItem;
|