@xaui/native 0.0.15 → 0.0.16
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 +3 -2
- package/dist/button/index.cjs +19 -15
- package/dist/button/index.d.cts +11 -95
- package/dist/button/index.d.ts +11 -95
- package/dist/button/index.js +19 -15
- package/dist/button.type-D8tzEBo7.d.ts +104 -0
- package/dist/button.type-ikaWzhIg.d.cts +104 -0
- package/dist/chunk-EI5OMBFE.js +338 -0
- package/dist/chunk-II4QINLG.js +287 -0
- package/dist/fab/index.cjs +725 -0
- package/dist/fab/index.d.cts +10 -0
- package/dist/fab/index.d.ts +10 -0
- package/dist/fab/index.js +8 -0
- package/dist/fab-menu/index.cjs +1072 -0
- package/dist/fab-menu/index.d.cts +125 -0
- package/dist/fab-menu/index.d.ts +125 -0
- package/dist/fab-menu/index.js +11 -0
- package/dist/fab.type-Ba0QMprb.d.ts +86 -0
- package/dist/fab.type-U09H8B7D.d.cts +86 -0
- package/dist/index.cjs +613 -4
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +10 -0
- package/package.json +11 -1
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ function Banner() {
|
|
|
58
58
|
|
|
59
59
|
### `Button`
|
|
60
60
|
|
|
61
|
-
- Variants: `solid`, `outlined`, `flat`, `light`, `
|
|
61
|
+
- Variants: `solid`, `outlined`, `flat`, `light`, `faded`
|
|
62
62
|
- Sizes: `xs`, `sm`, `md`, `lg`
|
|
63
63
|
- Radii: `none`, `sm`, `md`, `lg`, `full`
|
|
64
64
|
- Supports start/end content, `fullWidth`, `isDisabled`, `isLoading` with an integrated spinner
|
|
@@ -67,7 +67,8 @@ function Banner() {
|
|
|
67
67
|
```tsx
|
|
68
68
|
<Button
|
|
69
69
|
themeColor="primary"
|
|
70
|
-
variant="
|
|
70
|
+
variant="solid"
|
|
71
|
+
elevation={2}
|
|
71
72
|
size="lg"
|
|
72
73
|
radius="full"
|
|
73
74
|
isLoading={saving}
|
package/dist/button/index.cjs
CHANGED
|
@@ -511,7 +511,7 @@ var useTextStyles = (themeColor, variant) => {
|
|
|
511
511
|
const safeThemeColor = (0, import_core6.getSafeThemeColor)(themeColor);
|
|
512
512
|
const colorScheme = theme.colors[safeThemeColor];
|
|
513
513
|
const textColor = (0, import_react10.useMemo)(() => {
|
|
514
|
-
if (variant === "solid"
|
|
514
|
+
if (variant === "solid") {
|
|
515
515
|
return colorScheme.foreground;
|
|
516
516
|
}
|
|
517
517
|
return colorScheme.main;
|
|
@@ -562,7 +562,7 @@ function useSizesStyles(size) {
|
|
|
562
562
|
}, [size]);
|
|
563
563
|
return { sizeStyles, spinnerSize };
|
|
564
564
|
}
|
|
565
|
-
function useVariantSizesStyles(themeColor, variant) {
|
|
565
|
+
function useVariantSizesStyles(themeColor, variant, elevation = 0) {
|
|
566
566
|
const theme = useXUITheme();
|
|
567
567
|
const safeThemeColor = (0, import_core6.getSafeThemeColor)(themeColor);
|
|
568
568
|
const colorScheme = theme.colors[safeThemeColor];
|
|
@@ -585,19 +585,21 @@ function useVariantSizesStyles(themeColor, variant) {
|
|
|
585
585
|
backgroundColor: "transparent",
|
|
586
586
|
borderWidth: 0
|
|
587
587
|
},
|
|
588
|
-
elevated: {
|
|
589
|
-
backgroundColor: colorScheme.main,
|
|
590
|
-
borderWidth: 0,
|
|
591
|
-
...theme.shadows.md
|
|
592
|
-
},
|
|
593
588
|
faded: {
|
|
594
589
|
backgroundColor: `${colorScheme.background}95`,
|
|
595
590
|
borderWidth: theme.borderWidth.md,
|
|
596
591
|
borderColor: `${colorScheme.main}90`
|
|
597
592
|
}
|
|
598
593
|
};
|
|
599
|
-
|
|
600
|
-
|
|
594
|
+
const baseStyle = styles3[variant];
|
|
595
|
+
const shouldApplyElevation = variant !== "outlined" && variant !== "light";
|
|
596
|
+
const shadowStyles = elevation === 0 ? {} : elevation === 1 ? theme.shadows.sm : elevation === 2 ? theme.shadows.md : elevation === 3 ? theme.shadows.lg : theme.shadows.xl;
|
|
597
|
+
return {
|
|
598
|
+
...baseStyle,
|
|
599
|
+
...shouldApplyElevation ? shadowStyles : {},
|
|
600
|
+
...shouldApplyElevation && elevation > 0 ? { elevation } : {}
|
|
601
|
+
};
|
|
602
|
+
}, [variant, colorScheme, theme, elevation]);
|
|
601
603
|
return variantStyles;
|
|
602
604
|
}
|
|
603
605
|
|
|
@@ -647,6 +649,7 @@ var Button = ({
|
|
|
647
649
|
fullWidth = false,
|
|
648
650
|
isDisabled = false,
|
|
649
651
|
isLoading = false,
|
|
652
|
+
elevation = 0,
|
|
650
653
|
customAppearance,
|
|
651
654
|
onPress,
|
|
652
655
|
onLongPress,
|
|
@@ -657,7 +660,7 @@ var Button = ({
|
|
|
657
660
|
const animatedOpacity = import_react11.default.useRef(new import_react_native10.Animated.Value(1)).current;
|
|
658
661
|
const { sizeStyles, spinnerSize } = useSizesStyles(size);
|
|
659
662
|
const radiusStyles = useBorderRadiusStyles(radius);
|
|
660
|
-
const variantStyles = useVariantSizesStyles(themeColor, variant);
|
|
663
|
+
const variantStyles = useVariantSizesStyles(themeColor, variant, elevation);
|
|
661
664
|
const { textColor } = useTextStyles(themeColor, variant);
|
|
662
665
|
const handlePressIn = (event) => {
|
|
663
666
|
if (!isDisabled && !isLoading) {
|
|
@@ -675,8 +678,8 @@ var Button = ({
|
|
|
675
678
|
ActivityIndicator,
|
|
676
679
|
{
|
|
677
680
|
variant: "circular",
|
|
678
|
-
themeColor: variant === "solid"
|
|
679
|
-
color: variant === "solid"
|
|
681
|
+
themeColor: variant === "solid" ? void 0 : themeColor,
|
|
682
|
+
color: variant === "solid" ? textColor : void 0,
|
|
680
683
|
size: spinnerSize
|
|
681
684
|
}
|
|
682
685
|
);
|
|
@@ -767,6 +770,7 @@ var IconButton = ({
|
|
|
767
770
|
radius = "md",
|
|
768
771
|
isDisabled = false,
|
|
769
772
|
isLoading = false,
|
|
773
|
+
elevation = 0,
|
|
770
774
|
customAppearance,
|
|
771
775
|
onPress,
|
|
772
776
|
onLongPress,
|
|
@@ -777,7 +781,7 @@ var IconButton = ({
|
|
|
777
781
|
const animatedOpacity = import_react13.default.useRef(new import_react_native12.Animated.Value(1)).current;
|
|
778
782
|
const sizeStyles = useIconButtonSizeStyles(size);
|
|
779
783
|
const radiusStyles = useBorderRadiusStyles(radius);
|
|
780
|
-
const variantStyles = useVariantSizesStyles(themeColor, variant);
|
|
784
|
+
const variantStyles = useVariantSizesStyles(themeColor, variant, elevation);
|
|
781
785
|
const { textColor } = useTextStyles(themeColor, variant);
|
|
782
786
|
const handlePressIn = (event) => {
|
|
783
787
|
if (!isDisabled && !isLoading) {
|
|
@@ -826,8 +830,8 @@ var IconButton = ({
|
|
|
826
830
|
ActivityIndicator,
|
|
827
831
|
{
|
|
828
832
|
variant: "circular",
|
|
829
|
-
themeColor: variant === "solid"
|
|
830
|
-
color: variant === "solid"
|
|
833
|
+
themeColor: variant === "solid" ? void 0 : themeColor,
|
|
834
|
+
color: variant === "solid" ? textColor : void 0,
|
|
831
835
|
size: spinnerSize
|
|
832
836
|
}
|
|
833
837
|
) : icon
|
package/dist/button/index.d.cts
CHANGED
|
@@ -1,98 +1,8 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type ButtonRadius = 'none' | 'sm' | 'md' | 'lg' | 'full';
|
|
7
|
-
type SpinnerPlacement = 'start' | 'end';
|
|
8
|
-
type ButtonCustomAppearance = {
|
|
9
|
-
/**
|
|
10
|
-
* Custom styles for the outer container
|
|
11
|
-
*/
|
|
12
|
-
container?: ViewStyle;
|
|
13
|
-
/**
|
|
14
|
-
* Custom styles for the button
|
|
15
|
-
*/
|
|
16
|
-
button?: ViewStyle;
|
|
17
|
-
/**
|
|
18
|
-
* Custom styles for the button text
|
|
19
|
-
*/
|
|
20
|
-
text?: TextStyle;
|
|
21
|
-
};
|
|
22
|
-
type ButtonProps = {
|
|
23
|
-
/**
|
|
24
|
-
* The content to display in the button.
|
|
25
|
-
*/
|
|
26
|
-
children: ReactNode;
|
|
27
|
-
/**
|
|
28
|
-
* The theme color of the button.
|
|
29
|
-
* @default 'default'
|
|
30
|
-
*/
|
|
31
|
-
themeColor?: ThemeColor;
|
|
32
|
-
/**
|
|
33
|
-
* The variant of the button.
|
|
34
|
-
* @default 'solid'
|
|
35
|
-
*/
|
|
36
|
-
variant?: ButtonVariant;
|
|
37
|
-
/**
|
|
38
|
-
* The size of the button.
|
|
39
|
-
* @default 'md'
|
|
40
|
-
*/
|
|
41
|
-
size?: Size;
|
|
42
|
-
/**
|
|
43
|
-
* The border radius of the button.
|
|
44
|
-
* @default 'md'
|
|
45
|
-
*/
|
|
46
|
-
radius?: ButtonRadius;
|
|
47
|
-
/**
|
|
48
|
-
* Content to display at the start of the button.
|
|
49
|
-
*/
|
|
50
|
-
startContent?: ReactNode;
|
|
51
|
-
/**
|
|
52
|
-
* Content to display at the end of the button.
|
|
53
|
-
*/
|
|
54
|
-
endContent?: ReactNode;
|
|
55
|
-
/**
|
|
56
|
-
* The placement of the spinner when isLoading is true.
|
|
57
|
-
* @default 'start'
|
|
58
|
-
*/
|
|
59
|
-
spinnerPlacement?: SpinnerPlacement;
|
|
60
|
-
/**
|
|
61
|
-
* Whether the button should take the full width of its container.
|
|
62
|
-
* @default false
|
|
63
|
-
*/
|
|
64
|
-
fullWidth?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Whether the button is disabled.
|
|
67
|
-
* @default false
|
|
68
|
-
*/
|
|
69
|
-
isDisabled?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Whether the button is in a loading state.
|
|
72
|
-
* @default false
|
|
73
|
-
*/
|
|
74
|
-
isLoading?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Custom appearance styles for button parts
|
|
77
|
-
*/
|
|
78
|
-
customAppearance?: ButtonCustomAppearance;
|
|
79
|
-
/**
|
|
80
|
-
* Callback fired when the button is pressed.
|
|
81
|
-
*/
|
|
82
|
-
onPress?: (event: GestureResponderEvent) => void;
|
|
83
|
-
/**
|
|
84
|
-
* Callback fired when the button is long pressed.
|
|
85
|
-
*/
|
|
86
|
-
onLongPress?: (event: GestureResponderEvent) => void;
|
|
87
|
-
/**
|
|
88
|
-
* Callback fired when the button press starts.
|
|
89
|
-
*/
|
|
90
|
-
onPressIn?: (event: GestureResponderEvent) => void;
|
|
91
|
-
/**
|
|
92
|
-
* Callback fired when the button press ends.
|
|
93
|
-
*/
|
|
94
|
-
onPressOut?: (event: GestureResponderEvent) => void;
|
|
95
|
-
};
|
|
2
|
+
import { a as ButtonProps, b as ButtonVariant, B as ButtonRadius, E as ElevationLevel } from '../button.type-ikaWzhIg.cjs';
|
|
3
|
+
export { S as SpinnerPlacement } from '../button.type-ikaWzhIg.cjs';
|
|
4
|
+
import { ViewStyle, GestureResponderEvent } from 'react-native';
|
|
5
|
+
import { S as Size, T as ThemeColor } from '../index-BOw6tbkc.cjs';
|
|
96
6
|
|
|
97
7
|
declare const Button: React.FC<ButtonProps>;
|
|
98
8
|
|
|
@@ -131,6 +41,12 @@ type IconButtonProps = {
|
|
|
131
41
|
* @default false
|
|
132
42
|
*/
|
|
133
43
|
isLoading?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Android elevation level from 0 to 4.
|
|
46
|
+
* Does not apply to `outlined` and `light` variants.
|
|
47
|
+
* @default 0
|
|
48
|
+
*/
|
|
49
|
+
elevation?: ElevationLevel;
|
|
134
50
|
/**
|
|
135
51
|
* Custom appearance overrides
|
|
136
52
|
*/
|
|
@@ -158,4 +74,4 @@ type IconButtonProps = {
|
|
|
158
74
|
|
|
159
75
|
declare const IconButton: React.FC<IconButtonProps>;
|
|
160
76
|
|
|
161
|
-
export { Button,
|
|
77
|
+
export { Button, ButtonProps, ButtonRadius, ButtonVariant, IconButton, type IconButtonProps };
|
package/dist/button/index.d.ts
CHANGED
|
@@ -1,98 +1,8 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type ButtonRadius = 'none' | 'sm' | 'md' | 'lg' | 'full';
|
|
7
|
-
type SpinnerPlacement = 'start' | 'end';
|
|
8
|
-
type ButtonCustomAppearance = {
|
|
9
|
-
/**
|
|
10
|
-
* Custom styles for the outer container
|
|
11
|
-
*/
|
|
12
|
-
container?: ViewStyle;
|
|
13
|
-
/**
|
|
14
|
-
* Custom styles for the button
|
|
15
|
-
*/
|
|
16
|
-
button?: ViewStyle;
|
|
17
|
-
/**
|
|
18
|
-
* Custom styles for the button text
|
|
19
|
-
*/
|
|
20
|
-
text?: TextStyle;
|
|
21
|
-
};
|
|
22
|
-
type ButtonProps = {
|
|
23
|
-
/**
|
|
24
|
-
* The content to display in the button.
|
|
25
|
-
*/
|
|
26
|
-
children: ReactNode;
|
|
27
|
-
/**
|
|
28
|
-
* The theme color of the button.
|
|
29
|
-
* @default 'default'
|
|
30
|
-
*/
|
|
31
|
-
themeColor?: ThemeColor;
|
|
32
|
-
/**
|
|
33
|
-
* The variant of the button.
|
|
34
|
-
* @default 'solid'
|
|
35
|
-
*/
|
|
36
|
-
variant?: ButtonVariant;
|
|
37
|
-
/**
|
|
38
|
-
* The size of the button.
|
|
39
|
-
* @default 'md'
|
|
40
|
-
*/
|
|
41
|
-
size?: Size;
|
|
42
|
-
/**
|
|
43
|
-
* The border radius of the button.
|
|
44
|
-
* @default 'md'
|
|
45
|
-
*/
|
|
46
|
-
radius?: ButtonRadius;
|
|
47
|
-
/**
|
|
48
|
-
* Content to display at the start of the button.
|
|
49
|
-
*/
|
|
50
|
-
startContent?: ReactNode;
|
|
51
|
-
/**
|
|
52
|
-
* Content to display at the end of the button.
|
|
53
|
-
*/
|
|
54
|
-
endContent?: ReactNode;
|
|
55
|
-
/**
|
|
56
|
-
* The placement of the spinner when isLoading is true.
|
|
57
|
-
* @default 'start'
|
|
58
|
-
*/
|
|
59
|
-
spinnerPlacement?: SpinnerPlacement;
|
|
60
|
-
/**
|
|
61
|
-
* Whether the button should take the full width of its container.
|
|
62
|
-
* @default false
|
|
63
|
-
*/
|
|
64
|
-
fullWidth?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Whether the button is disabled.
|
|
67
|
-
* @default false
|
|
68
|
-
*/
|
|
69
|
-
isDisabled?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Whether the button is in a loading state.
|
|
72
|
-
* @default false
|
|
73
|
-
*/
|
|
74
|
-
isLoading?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Custom appearance styles for button parts
|
|
77
|
-
*/
|
|
78
|
-
customAppearance?: ButtonCustomAppearance;
|
|
79
|
-
/**
|
|
80
|
-
* Callback fired when the button is pressed.
|
|
81
|
-
*/
|
|
82
|
-
onPress?: (event: GestureResponderEvent) => void;
|
|
83
|
-
/**
|
|
84
|
-
* Callback fired when the button is long pressed.
|
|
85
|
-
*/
|
|
86
|
-
onLongPress?: (event: GestureResponderEvent) => void;
|
|
87
|
-
/**
|
|
88
|
-
* Callback fired when the button press starts.
|
|
89
|
-
*/
|
|
90
|
-
onPressIn?: (event: GestureResponderEvent) => void;
|
|
91
|
-
/**
|
|
92
|
-
* Callback fired when the button press ends.
|
|
93
|
-
*/
|
|
94
|
-
onPressOut?: (event: GestureResponderEvent) => void;
|
|
95
|
-
};
|
|
2
|
+
import { a as ButtonProps, b as ButtonVariant, B as ButtonRadius, E as ElevationLevel } from '../button.type-D8tzEBo7.js';
|
|
3
|
+
export { S as SpinnerPlacement } from '../button.type-D8tzEBo7.js';
|
|
4
|
+
import { ViewStyle, GestureResponderEvent } from 'react-native';
|
|
5
|
+
import { S as Size, T as ThemeColor } from '../index-BOw6tbkc.js';
|
|
96
6
|
|
|
97
7
|
declare const Button: React.FC<ButtonProps>;
|
|
98
8
|
|
|
@@ -131,6 +41,12 @@ type IconButtonProps = {
|
|
|
131
41
|
* @default false
|
|
132
42
|
*/
|
|
133
43
|
isLoading?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Android elevation level from 0 to 4.
|
|
46
|
+
* Does not apply to `outlined` and `light` variants.
|
|
47
|
+
* @default 0
|
|
48
|
+
*/
|
|
49
|
+
elevation?: ElevationLevel;
|
|
134
50
|
/**
|
|
135
51
|
* Custom appearance overrides
|
|
136
52
|
*/
|
|
@@ -158,4 +74,4 @@ type IconButtonProps = {
|
|
|
158
74
|
|
|
159
75
|
declare const IconButton: React.FC<IconButtonProps>;
|
|
160
76
|
|
|
161
|
-
export { Button,
|
|
77
|
+
export { Button, ButtonProps, ButtonRadius, ButtonVariant, IconButton, type IconButtonProps };
|
package/dist/button/index.js
CHANGED
|
@@ -59,7 +59,7 @@ var useTextStyles = (themeColor, variant) => {
|
|
|
59
59
|
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
60
60
|
const colorScheme = theme.colors[safeThemeColor];
|
|
61
61
|
const textColor = useMemo(() => {
|
|
62
|
-
if (variant === "solid"
|
|
62
|
+
if (variant === "solid") {
|
|
63
63
|
return colorScheme.foreground;
|
|
64
64
|
}
|
|
65
65
|
return colorScheme.main;
|
|
@@ -110,7 +110,7 @@ function useSizesStyles(size) {
|
|
|
110
110
|
}, [size]);
|
|
111
111
|
return { sizeStyles, spinnerSize };
|
|
112
112
|
}
|
|
113
|
-
function useVariantSizesStyles(themeColor, variant) {
|
|
113
|
+
function useVariantSizesStyles(themeColor, variant, elevation = 0) {
|
|
114
114
|
const theme = useXUITheme();
|
|
115
115
|
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
116
116
|
const colorScheme = theme.colors[safeThemeColor];
|
|
@@ -133,19 +133,21 @@ function useVariantSizesStyles(themeColor, variant) {
|
|
|
133
133
|
backgroundColor: "transparent",
|
|
134
134
|
borderWidth: 0
|
|
135
135
|
},
|
|
136
|
-
elevated: {
|
|
137
|
-
backgroundColor: colorScheme.main,
|
|
138
|
-
borderWidth: 0,
|
|
139
|
-
...theme.shadows.md
|
|
140
|
-
},
|
|
141
136
|
faded: {
|
|
142
137
|
backgroundColor: `${colorScheme.background}95`,
|
|
143
138
|
borderWidth: theme.borderWidth.md,
|
|
144
139
|
borderColor: `${colorScheme.main}90`
|
|
145
140
|
}
|
|
146
141
|
};
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
const baseStyle = styles2[variant];
|
|
143
|
+
const shouldApplyElevation = variant !== "outlined" && 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]);
|
|
149
151
|
return variantStyles;
|
|
150
152
|
}
|
|
151
153
|
|
|
@@ -195,6 +197,7 @@ var Button = ({
|
|
|
195
197
|
fullWidth = false,
|
|
196
198
|
isDisabled = false,
|
|
197
199
|
isLoading = false,
|
|
200
|
+
elevation = 0,
|
|
198
201
|
customAppearance,
|
|
199
202
|
onPress,
|
|
200
203
|
onLongPress,
|
|
@@ -205,7 +208,7 @@ var Button = ({
|
|
|
205
208
|
const animatedOpacity = React.useRef(new Animated2.Value(1)).current;
|
|
206
209
|
const { sizeStyles, spinnerSize } = useSizesStyles(size);
|
|
207
210
|
const radiusStyles = useBorderRadiusStyles(radius);
|
|
208
|
-
const variantStyles = useVariantSizesStyles(themeColor, variant);
|
|
211
|
+
const variantStyles = useVariantSizesStyles(themeColor, variant, elevation);
|
|
209
212
|
const { textColor } = useTextStyles(themeColor, variant);
|
|
210
213
|
const handlePressIn = (event) => {
|
|
211
214
|
if (!isDisabled && !isLoading) {
|
|
@@ -223,8 +226,8 @@ var Button = ({
|
|
|
223
226
|
ActivityIndicator,
|
|
224
227
|
{
|
|
225
228
|
variant: "circular",
|
|
226
|
-
themeColor: variant === "solid"
|
|
227
|
-
color: variant === "solid"
|
|
229
|
+
themeColor: variant === "solid" ? void 0 : themeColor,
|
|
230
|
+
color: variant === "solid" ? textColor : void 0,
|
|
228
231
|
size: spinnerSize
|
|
229
232
|
}
|
|
230
233
|
);
|
|
@@ -315,6 +318,7 @@ var IconButton = ({
|
|
|
315
318
|
radius = "md",
|
|
316
319
|
isDisabled = false,
|
|
317
320
|
isLoading = false,
|
|
321
|
+
elevation = 0,
|
|
318
322
|
customAppearance,
|
|
319
323
|
onPress,
|
|
320
324
|
onLongPress,
|
|
@@ -325,7 +329,7 @@ var IconButton = ({
|
|
|
325
329
|
const animatedOpacity = React2.useRef(new Animated3.Value(1)).current;
|
|
326
330
|
const sizeStyles = useIconButtonSizeStyles(size);
|
|
327
331
|
const radiusStyles = useBorderRadiusStyles(radius);
|
|
328
|
-
const variantStyles = useVariantSizesStyles(themeColor, variant);
|
|
332
|
+
const variantStyles = useVariantSizesStyles(themeColor, variant, elevation);
|
|
329
333
|
const { textColor } = useTextStyles(themeColor, variant);
|
|
330
334
|
const handlePressIn = (event) => {
|
|
331
335
|
if (!isDisabled && !isLoading) {
|
|
@@ -374,8 +378,8 @@ var IconButton = ({
|
|
|
374
378
|
ActivityIndicator,
|
|
375
379
|
{
|
|
376
380
|
variant: "circular",
|
|
377
|
-
themeColor: variant === "solid"
|
|
378
|
-
color: variant === "solid"
|
|
381
|
+
themeColor: variant === "solid" ? void 0 : themeColor,
|
|
382
|
+
color: variant === "solid" ? textColor : void 0,
|
|
379
383
|
size: spinnerSize
|
|
380
384
|
}
|
|
381
385
|
) : icon
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ViewStyle, TextStyle, GestureResponderEvent } from 'react-native';
|
|
3
|
+
import { T as ThemeColor, S as Size } from './index-BOw6tbkc.js';
|
|
4
|
+
|
|
5
|
+
type ButtonVariant = 'solid' | 'outlined' | '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 `outlined` 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
|
+
export type { ButtonRadius as B, ElevationLevel as E, SpinnerPlacement as S, ButtonProps as a, ButtonVariant as b };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ViewStyle, TextStyle, GestureResponderEvent } from 'react-native';
|
|
3
|
+
import { T as ThemeColor, S as Size } from './index-BOw6tbkc.cjs';
|
|
4
|
+
|
|
5
|
+
type ButtonVariant = 'solid' | 'outlined' | '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 `outlined` 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
|
+
export type { ButtonRadius as B, ElevationLevel as E, SpinnerPlacement as S, ButtonProps as a, ButtonVariant as b };
|