@xaui/native 0.2.8 → 0.9.1-alpha.1
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-KFCORXWW.cjs +150 -0
- package/dist/chunk-M7P46XKI.cjs +100 -0
- package/dist/chunk-N357EQCZ.js +150 -0
- package/dist/chunk-NHPQQQ7P.cjs +734 -0
- package/dist/chunk-PBVPOX7D.js +734 -0
- package/dist/chunk-RBNCR5KB.js +100 -0
- package/dist/index.cjs +40 -1
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +40 -0
- package/dist/system/index.cjs +7 -0
- package/dist/system/index.d.cts +83 -0
- package/dist/system/index.d.ts +83 -0
- package/dist/system/index.js +7 -0
- package/dist/theme/index.cjs +36 -0
- package/dist/theme/index.d.cts +539 -0
- package/dist/theme/index.d.ts +539 -0
- package/dist/theme/index.js +36 -0
- package/dist/theme.type-B3ODSLbB.d.cts +153 -0
- package/dist/theme.type-B3ODSLbB.d.ts +153 -0
- package/package.json +30 -248
- package/README.md +0 -178
- package/dist/alert/index.cjs +0 -340
- package/dist/alert/index.d.cts +0 -46
- package/dist/alert/index.d.ts +0 -46
- package/dist/alert/index.js +0 -340
- 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/button/index.d.ts
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle, TextStyle, GestureResponderEvent } from 'react-native';
|
|
3
|
-
import { ThemeColor, Size } from '@xaui/core/types';
|
|
4
|
-
|
|
5
|
-
type ButtonVariant = 'solid' | 'bordered' | 'flat' | 'light' | 'faded';
|
|
6
|
-
type ButtonRadius = 'none' | 'sm' | 'md' | 'lg' | 'full';
|
|
7
|
-
type SpinnerPlacement = 'start' | 'end';
|
|
8
|
-
type ElevationLevel = 0 | 1 | 2 | 3 | 4;
|
|
9
|
-
type ButtonCustomAppearance = {
|
|
10
|
-
/**
|
|
11
|
-
* Custom styles for the outer container
|
|
12
|
-
*/
|
|
13
|
-
container?: ViewStyle;
|
|
14
|
-
/**
|
|
15
|
-
* Custom styles for the button
|
|
16
|
-
*/
|
|
17
|
-
button?: ViewStyle;
|
|
18
|
-
/**
|
|
19
|
-
* Custom styles for the button text
|
|
20
|
-
*/
|
|
21
|
-
text?: TextStyle;
|
|
22
|
-
};
|
|
23
|
-
type ButtonProps = {
|
|
24
|
-
/**
|
|
25
|
-
* The content to display in the button.
|
|
26
|
-
*/
|
|
27
|
-
children: ReactNode;
|
|
28
|
-
/**
|
|
29
|
-
* The theme color of the button.
|
|
30
|
-
* @default 'default'
|
|
31
|
-
*/
|
|
32
|
-
themeColor?: ThemeColor;
|
|
33
|
-
/**
|
|
34
|
-
* The variant of the button.
|
|
35
|
-
* @default 'solid'
|
|
36
|
-
*/
|
|
37
|
-
variant?: ButtonVariant;
|
|
38
|
-
/**
|
|
39
|
-
* The size of the button.
|
|
40
|
-
* @default 'md'
|
|
41
|
-
*/
|
|
42
|
-
size?: Size;
|
|
43
|
-
/**
|
|
44
|
-
* The border radius of the button.
|
|
45
|
-
* @default 'md'
|
|
46
|
-
*/
|
|
47
|
-
radius?: ButtonRadius;
|
|
48
|
-
/**
|
|
49
|
-
* Content to display at the start of the button.
|
|
50
|
-
*/
|
|
51
|
-
startContent?: ReactNode;
|
|
52
|
-
/**
|
|
53
|
-
* Content to display at the end of the button.
|
|
54
|
-
*/
|
|
55
|
-
endContent?: ReactNode;
|
|
56
|
-
/**
|
|
57
|
-
* The placement of the spinner when isLoading is true.
|
|
58
|
-
* @default 'start'
|
|
59
|
-
*/
|
|
60
|
-
spinnerPlacement?: SpinnerPlacement;
|
|
61
|
-
/**
|
|
62
|
-
* Whether the button should take the full width of its container.
|
|
63
|
-
* @default false
|
|
64
|
-
*/
|
|
65
|
-
fullWidth?: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Whether the button is disabled.
|
|
68
|
-
* @default false
|
|
69
|
-
*/
|
|
70
|
-
isDisabled?: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Whether the button is in a loading state.
|
|
73
|
-
* @default false
|
|
74
|
-
*/
|
|
75
|
-
isLoading?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Android elevation level from 0 to 4.
|
|
78
|
-
* Does not apply to `bordered` and `light` variants.
|
|
79
|
-
* @default 0
|
|
80
|
-
*/
|
|
81
|
-
elevation?: ElevationLevel;
|
|
82
|
-
/**
|
|
83
|
-
* Custom appearance styles for button parts
|
|
84
|
-
*/
|
|
85
|
-
customAppearance?: ButtonCustomAppearance;
|
|
86
|
-
/**
|
|
87
|
-
* Callback fired when the button is pressed.
|
|
88
|
-
*/
|
|
89
|
-
onPress?: (event: GestureResponderEvent) => void;
|
|
90
|
-
/**
|
|
91
|
-
* Callback fired when the button is long pressed.
|
|
92
|
-
*/
|
|
93
|
-
onLongPress?: (event: GestureResponderEvent) => void;
|
|
94
|
-
/**
|
|
95
|
-
* Callback fired when the button press starts.
|
|
96
|
-
*/
|
|
97
|
-
onPressIn?: (event: GestureResponderEvent) => void;
|
|
98
|
-
/**
|
|
99
|
-
* Callback fired when the button press ends.
|
|
100
|
-
*/
|
|
101
|
-
onPressOut?: (event: GestureResponderEvent) => void;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
declare const Button: React.FC<ButtonProps>;
|
|
105
|
-
|
|
106
|
-
type IconButtonProps = {
|
|
107
|
-
/**
|
|
108
|
-
* Icon to display in the button
|
|
109
|
-
*/
|
|
110
|
-
icon: ReactNode;
|
|
111
|
-
/**
|
|
112
|
-
* Button size
|
|
113
|
-
* @default 'md'
|
|
114
|
-
*/
|
|
115
|
-
size?: Size;
|
|
116
|
-
/**
|
|
117
|
-
* Button variant
|
|
118
|
-
* @default 'solid'
|
|
119
|
-
*/
|
|
120
|
-
variant?: ButtonVariant;
|
|
121
|
-
/**
|
|
122
|
-
* Theme color
|
|
123
|
-
* @default 'primary'
|
|
124
|
-
*/
|
|
125
|
-
themeColor?: ThemeColor;
|
|
126
|
-
/**
|
|
127
|
-
* Border radius
|
|
128
|
-
* @default 'md'
|
|
129
|
-
*/
|
|
130
|
-
radius?: ButtonRadius;
|
|
131
|
-
/**
|
|
132
|
-
* Whether the button is disabled
|
|
133
|
-
* @default false
|
|
134
|
-
*/
|
|
135
|
-
isDisabled?: boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Whether the button is loading
|
|
138
|
-
* @default false
|
|
139
|
-
*/
|
|
140
|
-
isLoading?: boolean;
|
|
141
|
-
/**
|
|
142
|
-
* Android elevation level from 0 to 4.
|
|
143
|
-
* Does not apply to `bordered` and `light` variants.
|
|
144
|
-
* @default 0
|
|
145
|
-
*/
|
|
146
|
-
elevation?: ElevationLevel;
|
|
147
|
-
/**
|
|
148
|
-
* Custom appearance overrides
|
|
149
|
-
*/
|
|
150
|
-
customAppearance?: {
|
|
151
|
-
container?: ViewStyle;
|
|
152
|
-
button?: ViewStyle;
|
|
153
|
-
};
|
|
154
|
-
/**
|
|
155
|
-
* Press handler
|
|
156
|
-
*/
|
|
157
|
-
onPress?: (event: GestureResponderEvent) => void;
|
|
158
|
-
/**
|
|
159
|
-
* Long press handler
|
|
160
|
-
*/
|
|
161
|
-
onLongPress?: (event: GestureResponderEvent) => void;
|
|
162
|
-
/**
|
|
163
|
-
* Press in handler
|
|
164
|
-
*/
|
|
165
|
-
onPressIn?: (event: GestureResponderEvent) => void;
|
|
166
|
-
/**
|
|
167
|
-
* Press out handler
|
|
168
|
-
*/
|
|
169
|
-
onPressOut?: (event: GestureResponderEvent) => void;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
declare const IconButton: React.FC<IconButtonProps>;
|
|
173
|
-
|
|
174
|
-
export { Button, type ButtonProps, type ButtonRadius, type ButtonVariant, IconButton, type IconButtonProps, type SpinnerPlacement };
|
package/dist/button/index.js
DELETED
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ActivityIndicator
|
|
3
|
-
} from "../chunk-VSZEXOUN.js";
|
|
4
|
-
import "../chunk-SHBDANQN.js";
|
|
5
|
-
import {
|
|
6
|
-
useBorderRadiusStyles,
|
|
7
|
-
useXUITheme
|
|
8
|
-
} from "../chunk-RBSA4NH4.js";
|
|
9
|
-
|
|
10
|
-
// src/components/button/button.tsx
|
|
11
|
-
import React from "react";
|
|
12
|
-
import { Pressable, Text, View, Animated as Animated2 } from "react-native";
|
|
13
|
-
|
|
14
|
-
// src/components/button/button.style.ts
|
|
15
|
-
import { StyleSheet } from "react-native";
|
|
16
|
-
var styles = StyleSheet.create({
|
|
17
|
-
button: {
|
|
18
|
-
flexDirection: "row",
|
|
19
|
-
alignItems: "center",
|
|
20
|
-
justifyContent: "center",
|
|
21
|
-
overflow: "hidden"
|
|
22
|
-
},
|
|
23
|
-
contentContainer: {
|
|
24
|
-
flexDirection: "row",
|
|
25
|
-
alignItems: "center",
|
|
26
|
-
justifyContent: "center",
|
|
27
|
-
gap: 8
|
|
28
|
-
},
|
|
29
|
-
text: {
|
|
30
|
-
fontWeight: "500",
|
|
31
|
-
textAlign: "center"
|
|
32
|
-
},
|
|
33
|
-
startContent: {
|
|
34
|
-
marginRight: 4
|
|
35
|
-
},
|
|
36
|
-
endContent: {
|
|
37
|
-
marginLeft: 4
|
|
38
|
-
},
|
|
39
|
-
spinner: {
|
|
40
|
-
marginHorizontal: 4
|
|
41
|
-
},
|
|
42
|
-
fullWidth: {
|
|
43
|
-
flexShrink: 1,
|
|
44
|
-
flexBasis: "auto",
|
|
45
|
-
width: "100%"
|
|
46
|
-
},
|
|
47
|
-
disabled: {
|
|
48
|
-
opacity: 0.5
|
|
49
|
-
},
|
|
50
|
-
disabledText: {
|
|
51
|
-
opacity: 0.7
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// src/components/button/button.hook.ts
|
|
56
|
-
import { useMemo } from "react";
|
|
57
|
-
import { getSafeThemeColor } from "@xaui/core";
|
|
58
|
-
var useTextStyles = (themeColor, variant) => {
|
|
59
|
-
const theme = useXUITheme();
|
|
60
|
-
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
61
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
62
|
-
const textColor = useMemo(() => {
|
|
63
|
-
if (variant === "solid") return colorScheme.onMain;
|
|
64
|
-
if (variant === "flat" || variant === "faded") return colorScheme.onContainer;
|
|
65
|
-
return colorScheme.main;
|
|
66
|
-
}, [variant, colorScheme]);
|
|
67
|
-
return {
|
|
68
|
-
textColor
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
function useSizesStyles(size) {
|
|
72
|
-
const theme = useXUITheme();
|
|
73
|
-
const sizeStyles = useMemo(() => {
|
|
74
|
-
const sizes = {
|
|
75
|
-
xs: {
|
|
76
|
-
paddingHorizontal: theme.spacing.sm,
|
|
77
|
-
paddingVertical: theme.spacing.xs,
|
|
78
|
-
minHeight: theme.componentSizes.xs,
|
|
79
|
-
fontSize: theme.fontSizes.xs
|
|
80
|
-
},
|
|
81
|
-
sm: {
|
|
82
|
-
paddingHorizontal: theme.spacing.md,
|
|
83
|
-
paddingVertical: theme.spacing.xs,
|
|
84
|
-
minHeight: theme.componentSizes.sm,
|
|
85
|
-
fontSize: theme.fontSizes.sm
|
|
86
|
-
},
|
|
87
|
-
md: {
|
|
88
|
-
paddingHorizontal: theme.spacing.md,
|
|
89
|
-
paddingVertical: theme.spacing.sm,
|
|
90
|
-
minHeight: theme.componentSizes.md,
|
|
91
|
-
fontSize: theme.fontSizes.md
|
|
92
|
-
},
|
|
93
|
-
lg: {
|
|
94
|
-
paddingHorizontal: theme.spacing.lg,
|
|
95
|
-
paddingVertical: theme.spacing.md,
|
|
96
|
-
minHeight: theme.componentSizes.lg,
|
|
97
|
-
fontSize: theme.fontSizes.lg
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
return sizes[size];
|
|
101
|
-
}, [size, theme]);
|
|
102
|
-
const spinnerSize = useMemo(() => {
|
|
103
|
-
const sizes = {
|
|
104
|
-
xs: 14,
|
|
105
|
-
sm: 16,
|
|
106
|
-
md: 18,
|
|
107
|
-
lg: 20
|
|
108
|
-
};
|
|
109
|
-
return sizes[size];
|
|
110
|
-
}, [size]);
|
|
111
|
-
return { sizeStyles, spinnerSize };
|
|
112
|
-
}
|
|
113
|
-
function useVariantSizesStyles(themeColor, variant, elevation = 0) {
|
|
114
|
-
const theme = useXUITheme();
|
|
115
|
-
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
116
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
117
|
-
const variantStyles = useMemo(() => {
|
|
118
|
-
const styles2 = {
|
|
119
|
-
solid: {
|
|
120
|
-
backgroundColor: colorScheme.main,
|
|
121
|
-
borderWidth: 0
|
|
122
|
-
},
|
|
123
|
-
bordered: {
|
|
124
|
-
backgroundColor: "transparent",
|
|
125
|
-
borderWidth: theme.borderWidth.md,
|
|
126
|
-
borderColor: colorScheme.main
|
|
127
|
-
},
|
|
128
|
-
flat: {
|
|
129
|
-
backgroundColor: colorScheme.container,
|
|
130
|
-
borderWidth: 0
|
|
131
|
-
},
|
|
132
|
-
light: {
|
|
133
|
-
backgroundColor: "transparent",
|
|
134
|
-
borderWidth: 0
|
|
135
|
-
},
|
|
136
|
-
faded: {
|
|
137
|
-
backgroundColor: colorScheme.container,
|
|
138
|
-
borderWidth: theme.borderWidth.md,
|
|
139
|
-
borderColor: colorScheme.main
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
const baseStyle = styles2[variant];
|
|
143
|
-
const shouldApplyElevation = variant !== "bordered" && variant !== "light";
|
|
144
|
-
const shadowStyles = elevation === 0 ? {} : elevation === 1 ? theme.shadows.sm : elevation === 2 ? theme.shadows.md : elevation === 3 ? theme.shadows.lg : theme.shadows.xl;
|
|
145
|
-
return {
|
|
146
|
-
...baseStyle,
|
|
147
|
-
...shouldApplyElevation ? shadowStyles : {},
|
|
148
|
-
...shouldApplyElevation && elevation > 0 ? { elevation } : {}
|
|
149
|
-
};
|
|
150
|
-
}, [variant, colorScheme, theme, elevation]);
|
|
151
|
-
return variantStyles;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// src/components/button/button.animation.ts
|
|
155
|
-
import { Animated } from "react-native";
|
|
156
|
-
var runPressInAnimation = (animatedScale, animatedOpacity) => {
|
|
157
|
-
Animated.parallel([
|
|
158
|
-
Animated.spring(animatedScale, {
|
|
159
|
-
toValue: 0.975,
|
|
160
|
-
useNativeDriver: true,
|
|
161
|
-
speed: 50,
|
|
162
|
-
bounciness: 0
|
|
163
|
-
}),
|
|
164
|
-
Animated.timing(animatedOpacity, {
|
|
165
|
-
toValue: 0.9,
|
|
166
|
-
duration: 100,
|
|
167
|
-
useNativeDriver: true
|
|
168
|
-
})
|
|
169
|
-
]).start();
|
|
170
|
-
};
|
|
171
|
-
var runPressOutAnimation = (animatedScale, animatedOpacity) => {
|
|
172
|
-
Animated.parallel([
|
|
173
|
-
Animated.spring(animatedScale, {
|
|
174
|
-
toValue: 1,
|
|
175
|
-
useNativeDriver: true,
|
|
176
|
-
speed: 50,
|
|
177
|
-
bounciness: 0
|
|
178
|
-
}),
|
|
179
|
-
Animated.timing(animatedOpacity, {
|
|
180
|
-
toValue: 1,
|
|
181
|
-
duration: 100,
|
|
182
|
-
useNativeDriver: true
|
|
183
|
-
})
|
|
184
|
-
]).start();
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
// src/components/button/button.tsx
|
|
188
|
-
var Button = ({
|
|
189
|
-
children,
|
|
190
|
-
themeColor = "primary",
|
|
191
|
-
variant = "solid",
|
|
192
|
-
size = "md",
|
|
193
|
-
radius = "md",
|
|
194
|
-
startContent,
|
|
195
|
-
endContent,
|
|
196
|
-
spinnerPlacement = "start",
|
|
197
|
-
fullWidth = false,
|
|
198
|
-
isDisabled = false,
|
|
199
|
-
isLoading = false,
|
|
200
|
-
elevation = 0,
|
|
201
|
-
customAppearance,
|
|
202
|
-
onPress,
|
|
203
|
-
onLongPress,
|
|
204
|
-
onPressIn,
|
|
205
|
-
onPressOut
|
|
206
|
-
}) => {
|
|
207
|
-
const animatedScale = React.useRef(new Animated2.Value(1)).current;
|
|
208
|
-
const animatedOpacity = React.useRef(new Animated2.Value(1)).current;
|
|
209
|
-
const { sizeStyles, spinnerSize } = useSizesStyles(size);
|
|
210
|
-
const radiusStyles = useBorderRadiusStyles(radius);
|
|
211
|
-
const variantStyles = useVariantSizesStyles(themeColor, variant, elevation);
|
|
212
|
-
const { textColor } = useTextStyles(themeColor, variant);
|
|
213
|
-
const handlePressIn = (event) => {
|
|
214
|
-
if (!isDisabled && !isLoading) {
|
|
215
|
-
runPressInAnimation(animatedScale, animatedOpacity);
|
|
216
|
-
}
|
|
217
|
-
onPressIn?.(event);
|
|
218
|
-
};
|
|
219
|
-
const handlePressOut = (event) => {
|
|
220
|
-
if (!isDisabled && !isLoading) {
|
|
221
|
-
runPressOutAnimation(animatedScale, animatedOpacity);
|
|
222
|
-
}
|
|
223
|
-
onPressOut?.(event);
|
|
224
|
-
};
|
|
225
|
-
const spinner = /* @__PURE__ */ React.createElement(
|
|
226
|
-
ActivityIndicator,
|
|
227
|
-
{
|
|
228
|
-
variant: "circular",
|
|
229
|
-
themeColor: variant === "solid" ? void 0 : themeColor,
|
|
230
|
-
color: variant === "solid" ? textColor : void 0,
|
|
231
|
-
size: spinnerSize
|
|
232
|
-
}
|
|
233
|
-
);
|
|
234
|
-
return /* @__PURE__ */ React.createElement(View, { style: [fullWidth && styles.fullWidth, customAppearance?.container] }, /* @__PURE__ */ React.createElement(
|
|
235
|
-
Pressable,
|
|
236
|
-
{
|
|
237
|
-
onPress: isDisabled || isLoading ? void 0 : onPress,
|
|
238
|
-
onLongPress: isDisabled || isLoading ? void 0 : onLongPress,
|
|
239
|
-
onPressIn: handlePressIn,
|
|
240
|
-
onPressOut: handlePressOut,
|
|
241
|
-
disabled: isDisabled || isLoading
|
|
242
|
-
},
|
|
243
|
-
/* @__PURE__ */ React.createElement(
|
|
244
|
-
Animated2.View,
|
|
245
|
-
{
|
|
246
|
-
style: [
|
|
247
|
-
styles.button,
|
|
248
|
-
sizeStyles,
|
|
249
|
-
radiusStyles,
|
|
250
|
-
variantStyles,
|
|
251
|
-
fullWidth && styles.fullWidth,
|
|
252
|
-
isDisabled && styles.disabled,
|
|
253
|
-
{
|
|
254
|
-
transform: [{ scale: animatedScale }],
|
|
255
|
-
opacity: animatedOpacity
|
|
256
|
-
},
|
|
257
|
-
customAppearance?.button
|
|
258
|
-
]
|
|
259
|
-
},
|
|
260
|
-
/* @__PURE__ */ React.createElement(View, { style: styles.contentContainer }, startContent && (!isLoading || spinnerPlacement !== "start") && /* @__PURE__ */ React.createElement(View, { style: styles.startContent }, startContent), isLoading && spinnerPlacement === "start" && /* @__PURE__ */ React.createElement(View, { style: styles.spinner }, spinner), /* @__PURE__ */ React.createElement(
|
|
261
|
-
Text,
|
|
262
|
-
{
|
|
263
|
-
style: [
|
|
264
|
-
styles.text,
|
|
265
|
-
{ fontSize: sizeStyles.fontSize, color: textColor },
|
|
266
|
-
isDisabled && styles.disabledText,
|
|
267
|
-
customAppearance?.text
|
|
268
|
-
]
|
|
269
|
-
},
|
|
270
|
-
children
|
|
271
|
-
), isLoading && spinnerPlacement === "end" && /* @__PURE__ */ React.createElement(View, { style: styles.spinner }, spinner), endContent && (!isLoading || spinnerPlacement !== "end") && /* @__PURE__ */ React.createElement(View, { style: styles.endContent }, endContent))
|
|
272
|
-
)
|
|
273
|
-
));
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
// src/components/button/icon-button.tsx
|
|
277
|
-
import React2 from "react";
|
|
278
|
-
import { Pressable as Pressable2, View as View2, Animated as Animated3 } from "react-native";
|
|
279
|
-
|
|
280
|
-
// src/components/button/icon-button.style.ts
|
|
281
|
-
import { StyleSheet as StyleSheet2 } from "react-native";
|
|
282
|
-
var iconButtonStyles = StyleSheet2.create({
|
|
283
|
-
container: {
|
|
284
|
-
alignItems: "center",
|
|
285
|
-
justifyContent: "center"
|
|
286
|
-
},
|
|
287
|
-
button: {
|
|
288
|
-
alignItems: "center",
|
|
289
|
-
justifyContent: "center",
|
|
290
|
-
aspectRatio: 1
|
|
291
|
-
},
|
|
292
|
-
disabled: {
|
|
293
|
-
opacity: 0.5
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
// src/components/button/icon-button.hook.ts
|
|
298
|
-
import { useMemo as useMemo2 } from "react";
|
|
299
|
-
var useIconButtonSizeStyles = (size) => {
|
|
300
|
-
const theme = useXUITheme();
|
|
301
|
-
return useMemo2(() => {
|
|
302
|
-
const sizeMap = {
|
|
303
|
-
xs: { width: theme.componentSizes.xs, height: theme.componentSizes.xs },
|
|
304
|
-
sm: { width: theme.componentSizes.sm, height: theme.componentSizes.sm },
|
|
305
|
-
md: { width: theme.componentSizes.md, height: theme.componentSizes.md },
|
|
306
|
-
lg: { width: theme.componentSizes.lg, height: theme.componentSizes.md }
|
|
307
|
-
};
|
|
308
|
-
return sizeMap[size];
|
|
309
|
-
}, [size, theme]);
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
// src/components/button/icon-button.tsx
|
|
313
|
-
var IconButton = ({
|
|
314
|
-
icon,
|
|
315
|
-
themeColor = "primary",
|
|
316
|
-
variant = "solid",
|
|
317
|
-
size = "md",
|
|
318
|
-
radius = "md",
|
|
319
|
-
isDisabled = false,
|
|
320
|
-
isLoading = false,
|
|
321
|
-
elevation = 0,
|
|
322
|
-
customAppearance,
|
|
323
|
-
onPress,
|
|
324
|
-
onLongPress,
|
|
325
|
-
onPressIn,
|
|
326
|
-
onPressOut
|
|
327
|
-
}) => {
|
|
328
|
-
const animatedScale = React2.useRef(new Animated3.Value(1)).current;
|
|
329
|
-
const animatedOpacity = React2.useRef(new Animated3.Value(1)).current;
|
|
330
|
-
const sizeStyles = useIconButtonSizeStyles(size);
|
|
331
|
-
const radiusStyles = useBorderRadiusStyles(radius);
|
|
332
|
-
const variantStyles = useVariantSizesStyles(themeColor, variant, elevation);
|
|
333
|
-
const { textColor } = useTextStyles(themeColor, variant);
|
|
334
|
-
const handlePressIn = (event) => {
|
|
335
|
-
if (!isDisabled && !isLoading) {
|
|
336
|
-
runPressInAnimation(animatedScale, animatedOpacity);
|
|
337
|
-
}
|
|
338
|
-
onPressIn?.(event);
|
|
339
|
-
};
|
|
340
|
-
const handlePressOut = (event) => {
|
|
341
|
-
if (!isDisabled && !isLoading) {
|
|
342
|
-
runPressOutAnimation(animatedScale, animatedOpacity);
|
|
343
|
-
}
|
|
344
|
-
onPressOut?.(event);
|
|
345
|
-
};
|
|
346
|
-
const spinnerSize = {
|
|
347
|
-
xs: 14,
|
|
348
|
-
sm: 16,
|
|
349
|
-
md: 18,
|
|
350
|
-
lg: 20
|
|
351
|
-
}[size];
|
|
352
|
-
return /* @__PURE__ */ React2.createElement(View2, { style: [iconButtonStyles.container, customAppearance?.container] }, /* @__PURE__ */ React2.createElement(
|
|
353
|
-
Pressable2,
|
|
354
|
-
{
|
|
355
|
-
onPress: isDisabled || isLoading ? void 0 : onPress,
|
|
356
|
-
onLongPress: isDisabled || isLoading ? void 0 : onLongPress,
|
|
357
|
-
onPressIn: handlePressIn,
|
|
358
|
-
onPressOut: handlePressOut,
|
|
359
|
-
disabled: isDisabled || isLoading
|
|
360
|
-
},
|
|
361
|
-
/* @__PURE__ */ React2.createElement(
|
|
362
|
-
Animated3.View,
|
|
363
|
-
{
|
|
364
|
-
style: [
|
|
365
|
-
iconButtonStyles.button,
|
|
366
|
-
sizeStyles,
|
|
367
|
-
radiusStyles,
|
|
368
|
-
variantStyles,
|
|
369
|
-
isDisabled && iconButtonStyles.disabled,
|
|
370
|
-
{
|
|
371
|
-
transform: [{ scale: animatedScale }],
|
|
372
|
-
opacity: animatedOpacity
|
|
373
|
-
},
|
|
374
|
-
customAppearance?.button
|
|
375
|
-
]
|
|
376
|
-
},
|
|
377
|
-
isLoading ? /* @__PURE__ */ React2.createElement(
|
|
378
|
-
ActivityIndicator,
|
|
379
|
-
{
|
|
380
|
-
variant: "circular",
|
|
381
|
-
themeColor: variant === "solid" ? void 0 : themeColor,
|
|
382
|
-
color: variant === "solid" ? textColor : void 0,
|
|
383
|
-
size: spinnerSize
|
|
384
|
-
}
|
|
385
|
-
) : icon
|
|
386
|
-
)
|
|
387
|
-
));
|
|
388
|
-
};
|
|
389
|
-
export {
|
|
390
|
-
Button,
|
|
391
|
-
IconButton
|
|
392
|
-
};
|