@apple-pie/slice-native 0.1.4 → 0.1.7
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 +164 -97
- package/SliceNative.podspec +24 -0
- package/dist/cjs/components.js +19 -0
- package/dist/cjs/hooks.js +9 -0
- package/dist/cjs/index.js +27 -812
- package/dist/cjs/providers.js +9 -0
- package/dist/cjs/src/components/SliceBackgroundBlur/SliceBackgroundBlur.js +11 -0
- package/dist/cjs/src/components/SliceButton/SliceButton.js +146 -0
- package/dist/cjs/src/components/SliceIcon/SliceIcon.js +20 -0
- package/dist/cjs/src/components/SliceIcon/iconRegistry.js +668 -0
- package/dist/cjs/src/components/SliceIcon/icons.js +144 -0
- package/dist/cjs/src/components/SliceLiquidGlassView/SliceLiquidGlassView.js +12 -0
- package/dist/cjs/src/components/SliceText/SliceText.js +21 -0
- package/dist/cjs/src/components/SliceTextInput/SliceTextInput.js +117 -0
- package/dist/cjs/src/hooks/useCreateThemedStyles/useCreateThemedStyles.js +13 -0
- package/dist/cjs/src/hooks/useDeviceCapabilities/useDeviceCapabilities.js +19 -0
- package/dist/cjs/src/providers/SliceThemeProvider.js +37 -0
- package/dist/cjs/src/theme/colors/colors.js +253 -0
- package/dist/cjs/src/theme/corners/corners.js +14 -0
- package/dist/cjs/src/theme/elevations/elevations.js +17 -0
- package/dist/cjs/src/theme/motion/motion.js +15 -0
- package/dist/cjs/src/theme/motion.js +47 -0
- package/dist/cjs/src/theme/spacing/spacing.js +14 -0
- package/dist/cjs/src/theme/type/type.js +190 -0
- package/dist/cjs/src/utils/sizes/sizes.js +40 -0
- package/dist/cjs/src/utils/typography/typography.js +17 -0
- package/dist/cjs/theme.js +23 -538
- package/dist/cjs/utils.js +10 -0
- package/dist/esm/components.mjs +7 -0
- package/dist/esm/hooks.mjs +2 -0
- package/dist/esm/index.mjs +12 -813
- package/dist/esm/providers.mjs +1 -0
- package/dist/esm/src/components/SliceBackgroundBlur/SliceBackgroundBlur.mjs +9 -0
- package/dist/esm/src/components/SliceButton/SliceButton.mjs +144 -0
- package/dist/esm/src/components/SliceIcon/SliceIcon.mjs +18 -0
- package/dist/esm/src/components/SliceIcon/iconRegistry.mjs +666 -0
- package/dist/esm/src/components/SliceIcon/icons.mjs +142 -0
- package/dist/esm/src/components/SliceLiquidGlassView/SliceLiquidGlassView.mjs +10 -0
- package/dist/esm/src/components/SliceText/SliceText.mjs +19 -0
- package/dist/esm/src/components/SliceTextInput/SliceTextInput.mjs +115 -0
- package/dist/esm/src/hooks/useCreateThemedStyles/useCreateThemedStyles.mjs +11 -0
- package/dist/esm/src/hooks/useDeviceCapabilities/useDeviceCapabilities.mjs +17 -0
- package/dist/esm/src/providers/SliceThemeProvider.mjs +33 -0
- package/dist/esm/src/theme/colors/colors.mjs +249 -0
- package/dist/esm/src/theme/corners/corners.mjs +12 -0
- package/dist/esm/src/theme/elevations/elevations.mjs +15 -0
- package/dist/esm/src/theme/motion/motion.mjs +13 -0
- package/dist/esm/src/theme/motion.mjs +45 -0
- package/dist/esm/src/theme/spacing/spacing.mjs +12 -0
- package/dist/esm/src/theme/type/type.mjs +184 -0
- package/dist/esm/src/utils/sizes/sizes.mjs +37 -0
- package/dist/esm/src/utils/typography/typography.mjs +15 -0
- package/dist/esm/theme.mjs +7 -522
- package/dist/esm/utils.mjs +2 -0
- package/dist/react-native/native/src/components/SliceBackgroundBlur/SliceBackgroundBlur.js +6 -0
- package/dist/react-native/native/src/components/SliceBackgroundBlur/SliceBackgroundBlur.native.js +6 -0
- package/dist/react-native/native/src/components/SliceBackgroundBlur/_types.js +1 -0
- package/dist/react-native/native/src/components/SliceBackgroundBlur/index.js +1 -0
- package/dist/react-native/native/src/components/SliceButton/SliceButton.js +141 -0
- package/dist/react-native/native/src/components/SliceButton/_types.js +1 -0
- package/dist/react-native/native/src/components/SliceButton/index.js +1 -0
- package/dist/react-native/native/src/components/SliceIcon/SliceIcon.js +15 -0
- package/dist/react-native/native/src/components/SliceIcon/_types.js +1 -0
- package/dist/react-native/native/src/components/SliceIcon/iconRegistry.js +663 -0
- package/dist/react-native/native/src/components/SliceIcon/icons.js +140 -0
- package/dist/react-native/native/src/components/SliceIcon/index.js +2 -0
- package/dist/react-native/native/src/components/SliceLiquidGlassView/SliceLiquidGlassView.ios.js +6 -0
- package/dist/react-native/native/src/components/SliceLiquidGlassView/SliceLiquidGlassView.js +7 -0
- package/dist/react-native/native/src/components/SliceLiquidGlassView/_types.js +1 -0
- package/dist/react-native/native/src/components/SliceLiquidGlassView/index.js +1 -0
- package/dist/react-native/native/src/components/SliceText/SliceText.js +16 -0
- package/dist/react-native/native/src/components/SliceText/_types.js +1 -0
- package/dist/react-native/native/src/components/SliceText/index.js +1 -0
- package/dist/react-native/native/src/components/SliceTextInput/SliceTextInput.js +111 -0
- package/dist/react-native/native/src/components/SliceTextInput/_types.js +1 -0
- package/dist/react-native/native/src/components/SliceTextInput/index.js +1 -0
- package/dist/react-native/native/src/components/index.js +6 -0
- package/dist/react-native/native/src/hooks/index.js +2 -0
- package/dist/react-native/native/src/hooks/useCreateThemedStyles/index.js +1 -0
- package/dist/react-native/native/src/hooks/useCreateThemedStyles/useCreateThemedStyles.js +8 -0
- package/dist/react-native/native/src/hooks/useDeviceCapabilities/_types.js +1 -0
- package/dist/react-native/native/src/hooks/useDeviceCapabilities/index.js +1 -0
- package/dist/react-native/native/src/hooks/useDeviceCapabilities/useDeviceCapabilities.js +14 -0
- package/dist/react-native/native/src/hooks/useDeviceCapabilities/useDeviceCapabilities.native.js +23 -0
- package/dist/react-native/native/src/index.js +6 -0
- package/dist/react-native/native/src/providers/SliceThemeProvider.js +30 -0
- package/dist/react-native/native/src/providers/index.js +1 -0
- package/dist/react-native/native/src/specs/BackgroundBlurNativeComponent.ts +16 -0
- package/dist/react-native/native/src/specs/LiquidGlassNativeComponent.ts +18 -0
- package/dist/react-native/native/src/specs/NativeDeviceCapabilities.ts +13 -0
- package/dist/react-native/native/src/theme/index.js +69 -0
- package/dist/react-native/native/src/theme/motion.js +43 -0
- package/dist/react-native/native/src/types/index.js +1 -0
- package/dist/react-native/native/src/types/sharedTypes.js +1 -0
- package/dist/react-native/native/src/utils/index.js +2 -0
- package/dist/react-native/native/src/utils/sizes/index.js +1 -0
- package/dist/react-native/native/src/utils/sizes/sizes.js +35 -0
- package/dist/react-native/native/src/utils/typography/index.js +1 -0
- package/dist/react-native/native/src/utils/typography/typography.js +13 -0
- package/dist/react-native/src/theme/colors/colors.js +385 -0
- package/dist/react-native/src/theme/colors/types.js +1 -0
- package/dist/react-native/src/theme/corners/corners.js +10 -0
- package/dist/react-native/src/theme/corners/types.js +1 -0
- package/dist/react-native/src/theme/elevations/_types.js +1 -0
- package/dist/react-native/src/theme/elevations/elevations.js +13 -0
- package/dist/react-native/src/theme/motion/_types.js +1 -0
- package/dist/react-native/src/theme/motion/motion.js +11 -0
- package/dist/react-native/src/theme/spacing/_types.js +1 -0
- package/dist/react-native/src/theme/spacing/spacing.js +10 -0
- package/dist/react-native/src/theme/type/type.js +371 -0
- package/dist/react-native/src/theme/type/types.js +1 -0
- package/dist/types/native/src/components/SliceBackgroundBlur/SliceBackgroundBlur.d.ts +3 -0
- package/dist/types/native/src/components/SliceBackgroundBlur/SliceBackgroundBlur.native.d.ts +2 -0
- package/dist/types/native/src/components/SliceBackgroundBlur/_types.d.ts +24 -0
- package/dist/types/native/src/components/SliceBackgroundBlur/index.d.ts +2 -0
- package/dist/types/native/src/components/SliceButton/SliceButton.d.ts +5 -0
- package/dist/types/native/src/components/SliceButton/_types.d.ts +78 -0
- package/dist/types/native/src/components/SliceButton/index.d.ts +2 -0
- package/dist/types/native/src/components/SliceIcon/SliceIcon.d.ts +2 -0
- package/dist/types/native/{components/Icon → src/components/SliceIcon}/icons.d.ts +1 -0
- package/dist/types/native/src/components/SliceIcon/index.d.ts +3 -0
- package/dist/types/native/src/components/SliceLiquidGlassView/SliceLiquidGlassView.d.ts +3 -0
- package/dist/types/native/src/components/SliceLiquidGlassView/SliceLiquidGlassView.ios.d.ts +2 -0
- package/dist/types/native/src/components/SliceLiquidGlassView/_types.d.ts +17 -0
- package/dist/types/native/src/components/SliceLiquidGlassView/index.d.ts +2 -0
- package/dist/types/native/src/components/SliceText/SliceText.d.ts +5 -0
- package/dist/types/native/src/components/SliceText/_types.d.ts +17 -0
- package/dist/types/native/src/components/SliceText/index.d.ts +2 -0
- package/dist/types/native/src/components/SliceTextInput/SliceTextInput.d.ts +2 -0
- package/dist/types/native/src/components/SliceTextInput/_types.d.ts +58 -0
- package/dist/types/native/src/components/SliceTextInput/index.d.ts +2 -0
- package/dist/types/native/src/components/index.d.ts +12 -0
- package/dist/types/native/src/hooks/index.d.ts +3 -0
- package/dist/types/native/src/hooks/useCreateThemedStyles/index.d.ts +1 -0
- package/dist/types/native/src/hooks/useCreateThemedStyles/useCreateThemedStyles.d.ts +7 -0
- package/dist/types/native/src/hooks/useDeviceCapabilities/_types.d.ts +17 -0
- package/dist/types/native/src/hooks/useDeviceCapabilities/index.d.ts +2 -0
- package/dist/types/native/src/hooks/useDeviceCapabilities/useDeviceCapabilities.d.ts +3 -0
- package/dist/types/native/src/hooks/useDeviceCapabilities/useDeviceCapabilities.native.d.ts +7 -0
- package/dist/types/native/src/index.d.ts +12 -0
- package/dist/types/native/src/providers/SliceThemeProvider.d.ts +16 -0
- package/dist/types/native/src/providers/index.d.ts +2 -0
- package/dist/types/native/src/specs/BackgroundBlurNativeComponent.d.ts +9 -0
- package/dist/types/native/src/specs/LiquidGlassNativeComponent.d.ts +9 -0
- package/dist/types/native/src/specs/NativeDeviceCapabilities.d.ts +11 -0
- package/dist/types/native/{theme → src/theme}/index.d.ts +5 -5
- package/dist/types/native/src/types/index.d.ts +1 -0
- package/dist/types/native/src/types/sharedTypes.d.ts +14 -0
- package/dist/types/native/src/utils/index.d.ts +2 -0
- package/dist/types/native/src/utils/sizes/index.d.ts +1 -0
- package/dist/types/native/src/utils/sizes/sizes.d.ts +7 -0
- package/dist/types/native/src/utils/typography/index.d.ts +1 -0
- package/dist/types/native/src/utils/typography/typography.d.ts +7 -0
- package/package.json +57 -11
- package/platform/android/build.gradle +22 -0
- package/platform/android/src/main/AndroidManifest.xml +1 -0
- package/platform/android/src/main/java/com/slice/SliceBackgroundBlurManager.java +28 -0
- package/platform/android/src/main/java/com/slice/SliceBackgroundBlurView.java +98 -0
- package/platform/android/src/main/java/com/slice/SliceDeviceCapabilitiesModule.java +25 -0
- package/platform/android/src/main/java/com/slice/SlicePackage.java +25 -0
- package/platform/ios/BackgroundBlurSurface.swift +89 -0
- package/platform/ios/LiquidGlassSurface.swift +82 -0
- package/platform/ios/RCTBackgroundBlurView.h +3 -0
- package/platform/ios/RCTBackgroundBlurView.mm +42 -0
- package/platform/ios/RCTLiquidGlassView.h +8 -0
- package/platform/ios/RCTLiquidGlassView.mm +73 -0
- package/platform/ios/SliceDeviceCapabilities.h +4 -0
- package/platform/ios/SliceDeviceCapabilities.mm +35 -0
- package/react-native.config.js +1 -0
- package/src/specs/BackgroundBlurNativeComponent.ts +16 -0
- package/src/specs/LiquidGlassNativeComponent.ts +18 -0
- package/src/specs/NativeDeviceCapabilities.ts +13 -0
- package/dist/types/native/components/Icon/NativeIcon.d.ts +0 -2
- package/dist/types/native/components/Icon/index.d.ts +0 -3
- package/dist/types/native/index.d.ts +0 -4
- /package/dist/types/native/{components/Icon → src/components/SliceIcon}/_types.d.ts +0 -0
- /package/dist/types/native/{components/Icon → src/components/SliceIcon}/iconRegistry.d.ts +0 -0
- /package/dist/types/native/{theme → src/theme}/motion.d.ts +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var SliceThemeProvider = require('./src/providers/SliceThemeProvider.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.SliceThemeProvider = SliceThemeProvider.SliceThemeProvider;
|
|
8
|
+
exports.useSliceContext = SliceThemeProvider.useSliceContext;
|
|
9
|
+
exports.useSliceTheme = SliceThemeProvider.useSliceTheme;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var reactNative = require('react-native');
|
|
5
|
+
|
|
6
|
+
/** Web/other-platform fallback. Metro selects the native implementation on iOS/Android. */
|
|
7
|
+
function SliceBackgroundBlur({ style, fallbackColor = 'rgba(128, 128, 128, 0.18)', }) {
|
|
8
|
+
return jsxRuntime.jsx(reactNative.View, { pointerEvents: "none", style: [reactNative.StyleSheet.absoluteFill, style, { backgroundColor: fallbackColor }] });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
exports.SliceBackgroundBlur = SliceBackgroundBlur;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var reactNative = require('react-native');
|
|
6
|
+
var Reanimated = require('react-native-reanimated');
|
|
7
|
+
var SliceThemeProvider = require('../../providers/SliceThemeProvider.js');
|
|
8
|
+
var useDeviceCapabilities = require('../../hooks/useDeviceCapabilities/useDeviceCapabilities.js');
|
|
9
|
+
var sizes = require('../../utils/sizes/sizes.js');
|
|
10
|
+
var SliceIcon = require('../SliceIcon/SliceIcon.js');
|
|
11
|
+
var SliceLiquidGlassView = require('../SliceLiquidGlassView/SliceLiquidGlassView.js');
|
|
12
|
+
var SliceText = require('../SliceText/SliceText.js');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Component logic & render
|
|
16
|
+
*/
|
|
17
|
+
function SliceButton(props) {
|
|
18
|
+
const { colors, name } = SliceThemeProvider.useSliceTheme();
|
|
19
|
+
const { supportsLiquidGlass } = useDeviceCapabilities.useDeviceCapabilities();
|
|
20
|
+
const isLightTheme = name.includes('light');
|
|
21
|
+
const { children, onPress, disabled = false, icon, iconPosition = 'left', iconSize = 24, size = 'm', animatedStyle, variant = 'primary', layout, presence, accessibilityState, liquidGlassBackground, borderRadius = 'pill', borderWidth, borderColor = colors['core-outline-secondary'], backgroundColor, ...pressableProps } = props;
|
|
22
|
+
const { fallbackColor, glassTintColor, glassStyle } = liquidGlassBackground ?? {};
|
|
23
|
+
const applyLiquidGlass = Boolean(liquidGlassBackground) && supportsLiquidGlass;
|
|
24
|
+
const hasLabel = children !== undefined && children !== null && children !== false && children !== '';
|
|
25
|
+
const pressableStyle = react.useMemo(() => {
|
|
26
|
+
if (!hasLabel)
|
|
27
|
+
return reactNative.StyleSheet.compose(styles.pressable, styles.pressableNoLabel);
|
|
28
|
+
if (icon && iconPosition === 'left')
|
|
29
|
+
return reactNative.StyleSheet.compose(styles.pressable, styles.pressableIconLeft);
|
|
30
|
+
if (icon && iconPosition === 'right')
|
|
31
|
+
return reactNative.StyleSheet.compose(styles.pressable, styles.pressableIconRight);
|
|
32
|
+
return styles.pressable;
|
|
33
|
+
}, [icon, iconPosition, hasLabel]);
|
|
34
|
+
const bgColor = react.useMemo(() => {
|
|
35
|
+
if (applyLiquidGlass)
|
|
36
|
+
return 'transparent';
|
|
37
|
+
const baseBGColor = variant === 'primary' ? colors['core-button-primary'] : colors['core-surface-primary'];
|
|
38
|
+
return backgroundColor ?? fallbackColor ?? baseBGColor;
|
|
39
|
+
}, [applyLiquidGlass, backgroundColor, fallbackColor, colors, variant]);
|
|
40
|
+
const colorStyles = react.useMemo(() => {
|
|
41
|
+
const disabledBGColor = disabled ? colors['core-surface-secondary'] : undefined;
|
|
42
|
+
const color = colors['core-text-primary'];
|
|
43
|
+
const disabledColor = disabled ? colors['core-text-disabled'] : undefined;
|
|
44
|
+
const iconColor = disabled
|
|
45
|
+
? disabledColor
|
|
46
|
+
: isLightTheme
|
|
47
|
+
? colors['core-icon-primary']
|
|
48
|
+
: colors['core-link-primary'];
|
|
49
|
+
return reactNative.StyleSheet.create({
|
|
50
|
+
backgroundColor: {
|
|
51
|
+
backgroundColor: applyLiquidGlass ? 'transparent' : (disabledBGColor ?? bgColor),
|
|
52
|
+
},
|
|
53
|
+
textColor: {
|
|
54
|
+
color: disabledColor ?? color,
|
|
55
|
+
},
|
|
56
|
+
ripple: {
|
|
57
|
+
color: 'rgba(255,255,255,0.5)',
|
|
58
|
+
},
|
|
59
|
+
icon: {
|
|
60
|
+
color: iconColor,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}, [applyLiquidGlass, disabled, colors, isLightTheme, bgColor]);
|
|
64
|
+
// Preserve variant defaults while allowing an explicit zero-width border.
|
|
65
|
+
const borderStyles = react.useMemo(() => {
|
|
66
|
+
const width = borderWidth ?? (variant === 'primary' ? 0 : 1);
|
|
67
|
+
return reactNative.StyleSheet.create({
|
|
68
|
+
border: {
|
|
69
|
+
borderWidth: Number.isFinite(width) ? Math.max(0, width) : 0,
|
|
70
|
+
borderColor,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}, [variant, borderColor, borderWidth]);
|
|
74
|
+
// disable touch events when button is disabled
|
|
75
|
+
const pointerEvents = react.useMemo(() => {
|
|
76
|
+
return reactNative.StyleSheet.create({
|
|
77
|
+
pointer: {
|
|
78
|
+
pointerEvents: disabled ? 'none' : 'auto',
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}, [disabled]);
|
|
82
|
+
// set the button size
|
|
83
|
+
const buttonSize = react.useMemo(() => {
|
|
84
|
+
return reactNative.StyleSheet.create({
|
|
85
|
+
size: {
|
|
86
|
+
minHeight: sizes.sizeToNumber(size),
|
|
87
|
+
width: hasLabel ? 'auto' : sizes.sizeToNumber(size),
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
}, [size, hasLabel]);
|
|
91
|
+
// set the button border radius
|
|
92
|
+
const cornerRadius = react.useMemo(() => {
|
|
93
|
+
return reactNative.StyleSheet.create({
|
|
94
|
+
borderRadius: {
|
|
95
|
+
borderRadius: sizes.borderRadiusToNumber(borderRadius),
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}, [borderRadius]);
|
|
99
|
+
return (jsxRuntime.jsx(Reanimated.View, { layout: layout, children: jsxRuntime.jsx(Reanimated.View, { entering: presence?.entering, exiting: presence?.exiting, children: jsxRuntime.jsxs(Reanimated.View, { style: [
|
|
100
|
+
styles.wrapper,
|
|
101
|
+
pointerEvents.pointer,
|
|
102
|
+
colorStyles.backgroundColor,
|
|
103
|
+
buttonSize.size,
|
|
104
|
+
borderStyles.border,
|
|
105
|
+
cornerRadius.borderRadius,
|
|
106
|
+
animatedStyle,
|
|
107
|
+
], children: [applyLiquidGlass && (jsxRuntime.jsx(SliceLiquidGlassView.SliceLiquidGlassView, { cornerRadius: sizes.borderRadiusToNumber(borderRadius), fallbackColor: fallbackColor, glassTintColor: glassTintColor, glassStyle: glassStyle, style: styles.background })), jsxRuntime.jsxs(reactNative.Pressable, { ...pressableProps, accessibilityRole: pressableProps.accessibilityRole ?? 'button', accessibilityState: { ...accessibilityState, disabled }, disabled: disabled, style: pressableStyle, onPress: disabled ? undefined : onPress, android_ripple: pressableProps.android_ripple ?? colorStyles.ripple, children: [icon && iconPosition === 'left' && (jsxRuntime.jsx(SliceIcon.SliceIcon, { name: icon, size: iconSize, strokeColor: colorStyles.icon.color, pointerEvents: "none", accessible: false })), hasLabel && (jsxRuntime.jsx(SliceText.StyledText, { textStyle: 'body-xl-bold', style: colorStyles.textColor, singleLine: true, numberOfLines: 1, ellipsizeMode: 'tail', children: children })), icon && iconPosition === 'right' && (jsxRuntime.jsx(SliceIcon.SliceIcon, { name: icon, size: iconSize, strokeColor: colorStyles.icon.color, pointerEvents: "none", accessible: false }))] })] }) }) }));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Base Styles
|
|
111
|
+
*/
|
|
112
|
+
const styles = reactNative.StyleSheet.create({
|
|
113
|
+
wrapper: {
|
|
114
|
+
position: 'relative',
|
|
115
|
+
overflow: 'hidden',
|
|
116
|
+
justifyContent: 'center',
|
|
117
|
+
alignItems: 'center',
|
|
118
|
+
width: 'auto',
|
|
119
|
+
},
|
|
120
|
+
background: {
|
|
121
|
+
position: 'absolute',
|
|
122
|
+
inset: 0,
|
|
123
|
+
},
|
|
124
|
+
pressable: {
|
|
125
|
+
flex: 1,
|
|
126
|
+
flexDirection: 'row',
|
|
127
|
+
gap: 6,
|
|
128
|
+
paddingHorizontal: 16,
|
|
129
|
+
justifyContent: 'center',
|
|
130
|
+
alignItems: 'center',
|
|
131
|
+
},
|
|
132
|
+
pressableIconLeft: {
|
|
133
|
+
paddingLeft: 16,
|
|
134
|
+
paddingRight: 22,
|
|
135
|
+
},
|
|
136
|
+
pressableIconRight: {
|
|
137
|
+
paddingLeft: 22,
|
|
138
|
+
paddingRight: 16,
|
|
139
|
+
},
|
|
140
|
+
pressableNoLabel: {
|
|
141
|
+
paddingLeft: 0,
|
|
142
|
+
paddingRight: 0,
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
exports.SliceButton = SliceButton;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var reactNative = require('react-native');
|
|
6
|
+
var Svg = require('react-native-svg');
|
|
7
|
+
var iconRegistry = require('./iconRegistry.js');
|
|
8
|
+
|
|
9
|
+
const SliceIcon = react.memo((props) => {
|
|
10
|
+
const dark = reactNative.useColorScheme() === 'dark';
|
|
11
|
+
const { name = 'home', size = 20, stroke = 1.5, strokeColor = dark ? '#ffffff' : '#000000', fillColor, fill = false, coverUp = dark ? '#000000' : '#ffffff', toggle = false, disabled = false, onPress, onPressIn, onPressOut, onLongPress, accessibilityState, opacity = 1, ...svgProps } = props;
|
|
12
|
+
const variant = iconRegistry.STATIC_ICON_REGISTRY.get(name);
|
|
13
|
+
const shape = toggle ? (variant?.lineOn ?? variant?.line) : variant?.line;
|
|
14
|
+
if (!shape)
|
|
15
|
+
return null;
|
|
16
|
+
return (jsxRuntime.jsx(Svg, { width: size, height: size, viewBox: "0 0 20 20", fill: "none", accessibilityRole: onPress || onLongPress ? 'button' : 'image', accessibilityLabel: `${name} icon`, ...svgProps, disabled: disabled, opacity: disabled ? Number(opacity) * 0.5 : opacity, accessibilityState: { ...accessibilityState, disabled }, onPress: disabled ? undefined : onPress, onPressIn: disabled ? undefined : onPressIn, onPressOut: disabled ? undefined : onPressOut, onLongPress: disabled ? undefined : onLongPress, children: shape({ stroke, strokeColor, fillColor: fill ? (fillColor ?? (dark ? 0.2 : 0.125)) : 0, coverUp }) }));
|
|
17
|
+
});
|
|
18
|
+
SliceIcon.displayName = 'SliceIcon';
|
|
19
|
+
|
|
20
|
+
exports.SliceIcon = SliceIcon;
|