@solostylist/ui-kit-native 1.0.1 → 1.0.3
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/hooks/use-count-down.d.ts +0 -2
- package/dist/hooks/use-count-down.d.ts.map +1 -1
- package/dist/hooks/use-count-down.js +0 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/s-avatar/s-avatar.d.ts +4 -8
- package/dist/s-avatar/s-avatar.d.ts.map +1 -1
- package/dist/s-avatar/s-avatar.js +49 -42
- package/dist/s-button/s-button.d.ts +0 -2
- package/dist/s-button/s-button.d.ts.map +1 -1
- package/dist/s-button/s-button.js +27 -24
- package/dist/s-button-link/s-button-link.d.ts +0 -2
- package/dist/s-button-link/s-button-link.d.ts.map +1 -1
- package/dist/s-button-link/s-button-link.js +21 -26
- package/dist/s-chat-input/index.d.ts +1 -1
- package/dist/s-chat-input/index.d.ts.map +1 -1
- package/dist/s-chat-input/s-chat-input.d.ts +19 -8
- package/dist/s-chat-input/s-chat-input.d.ts.map +1 -1
- package/dist/s-chat-input/s-chat-input.js +115 -46
- package/dist/s-chat-message/s-chat-message.d.ts +5 -7
- package/dist/s-chat-message/s-chat-message.d.ts.map +1 -1
- package/dist/s-chat-message/s-chat-message.js +100 -175
- package/dist/s-checkbox/s-checkbox.d.ts +0 -2
- package/dist/s-checkbox/s-checkbox.d.ts.map +1 -1
- package/dist/s-checkbox/s-checkbox.js +11 -18
- package/dist/s-chip/s-chip.d.ts +0 -2
- package/dist/s-chip/s-chip.d.ts.map +1 -1
- package/dist/s-chip/s-chip.js +35 -54
- package/dist/s-code-block/s-code-block.d.ts +0 -2
- package/dist/s-code-block/s-code-block.d.ts.map +1 -1
- package/dist/s-code-block/s-code-block.js +28 -40
- package/dist/s-comment-message/s-comment-message.d.ts +3 -5
- package/dist/s-comment-message/s-comment-message.d.ts.map +1 -1
- package/dist/s-comment-message/s-comment-message.js +54 -167
- package/dist/s-copyable-text/s-copyable-text.d.ts +0 -2
- package/dist/s-copyable-text/s-copyable-text.d.ts.map +1 -1
- package/dist/s-copyable-text/s-copyable-text.js +20 -45
- package/dist/s-countdown/index.d.ts +0 -1
- package/dist/s-countdown/index.d.ts.map +1 -1
- package/dist/s-countdown/index.js +0 -1
- package/dist/s-countdown/s-count-box.d.ts +5 -3
- package/dist/s-countdown/s-count-box.d.ts.map +1 -1
- package/dist/s-countdown/s-count-box.js +69 -60
- package/dist/s-countdown/s-countdown.d.ts +6 -3
- package/dist/s-countdown/s-countdown.d.ts.map +1 -1
- package/dist/s-countdown/s-countdown.js +11 -10
- package/dist/s-data-table/s-data-table.d.ts +0 -3
- package/dist/s-data-table/s-data-table.d.ts.map +1 -1
- package/dist/s-data-table/s-data-table.js +27 -50
- package/dist/s-date-picker/s-date-picker.d.ts +0 -2
- package/dist/s-date-picker/s-date-picker.d.ts.map +1 -1
- package/dist/s-date-picker/s-date-picker.js +51 -110
- package/dist/s-date-time-picker/s-date-time-picker.d.ts +0 -2
- package/dist/s-date-time-picker/s-date-time-picker.d.ts.map +1 -1
- package/dist/s-date-time-picker/s-date-time-picker.js +111 -203
- package/dist/s-divider/index.d.ts +2 -0
- package/dist/s-divider/index.d.ts.map +1 -0
- package/dist/s-divider/index.js +1 -0
- package/dist/s-divider/s-divider.d.ts +24 -0
- package/dist/s-divider/s-divider.d.ts.map +1 -0
- package/dist/s-divider/s-divider.js +30 -0
- package/dist/s-file-dropzone/s-file-dropzone.d.ts +0 -35
- package/dist/s-file-dropzone/s-file-dropzone.d.ts.map +1 -1
- package/dist/s-file-dropzone/s-file-dropzone.js +46 -120
- package/dist/s-file-icon/s-file-icon.d.ts +0 -2
- package/dist/s-file-icon/s-file-icon.d.ts.map +1 -1
- package/dist/s-file-icon/s-file-icon.js +11 -12
- package/dist/s-form/s-form.d.ts +0 -1
- package/dist/s-form/s-form.d.ts.map +1 -1
- package/dist/s-form/s-form.js +0 -1
- package/dist/s-icon-button/s-icon-button.d.ts +9 -9
- package/dist/s-icon-button/s-icon-button.d.ts.map +1 -1
- package/dist/s-icon-button/s-icon-button.js +38 -4
- package/dist/s-image-comparison/s-image-comparison.d.ts +3 -5
- package/dist/s-image-comparison/s-image-comparison.d.ts.map +1 -1
- package/dist/s-image-comparison/s-image-comparison.js +75 -102
- package/dist/s-label/s-label.d.ts +0 -1
- package/dist/s-label/s-label.d.ts.map +1 -1
- package/dist/s-label/s-label.js +8 -24
- package/dist/s-language-switcher/s-language-switcher.d.ts +2 -5
- package/dist/s-language-switcher/s-language-switcher.d.ts.map +1 -1
- package/dist/s-language-switcher/s-language-switcher.js +14 -25
- package/dist/s-lazy-image/s-lazy-image.d.ts +4 -6
- package/dist/s-lazy-image/s-lazy-image.d.ts.map +1 -1
- package/dist/s-lazy-image/s-lazy-image.js +37 -34
- package/dist/s-moving-border/s-moving-border.d.ts +0 -2
- package/dist/s-moving-border/s-moving-border.d.ts.map +1 -1
- package/dist/s-moving-border/s-moving-border.js +19 -24
- package/dist/s-multi-select/s-multi-select.d.ts +0 -2
- package/dist/s-multi-select/s-multi-select.d.ts.map +1 -1
- package/dist/s-multi-select/s-multi-select.js +54 -105
- package/dist/s-pagination/s-pagination.d.ts +12 -6
- package/dist/s-pagination/s-pagination.d.ts.map +1 -1
- package/dist/s-pagination/s-pagination.js +69 -43
- package/dist/s-rating/s-rating.d.ts +0 -2
- package/dist/s-rating/s-rating.d.ts.map +1 -1
- package/dist/s-rating/s-rating.js +31 -29
- package/dist/s-review/s-review.d.ts +6 -8
- package/dist/s-review/s-review.d.ts.map +1 -1
- package/dist/s-review/s-review.js +66 -153
- package/dist/s-scroll-to-top/s-scroll-to-top.d.ts +0 -2
- package/dist/s-scroll-to-top/s-scroll-to-top.d.ts.map +1 -1
- package/dist/s-scroll-to-top/s-scroll-to-top.js +17 -32
- package/dist/s-select/s-select.d.ts +5 -5
- package/dist/s-select/s-select.d.ts.map +1 -1
- package/dist/s-select/s-select.js +54 -94
- package/dist/s-select-list/s-select-list.d.ts +0 -2
- package/dist/s-select-list/s-select-list.d.ts.map +1 -1
- package/dist/s-select-list/s-select-list.js +24 -38
- package/dist/s-skeleton/index.d.ts +3 -0
- package/dist/s-skeleton/index.d.ts.map +1 -0
- package/dist/s-skeleton/index.js +1 -0
- package/dist/s-skeleton/s-skeleton.d.ts +27 -0
- package/dist/s-skeleton/s-skeleton.d.ts.map +1 -0
- package/dist/s-skeleton/s-skeleton.js +126 -0
- package/dist/s-switch/index.d.ts +3 -0
- package/dist/s-switch/index.d.ts.map +1 -0
- package/dist/s-switch/index.js +1 -0
- package/dist/s-switch/s-switch.d.ts +30 -0
- package/dist/s-switch/s-switch.d.ts.map +1 -0
- package/dist/s-switch/s-switch.js +44 -0
- package/dist/s-text-field/s-text-field.d.ts +0 -2
- package/dist/s-text-field/s-text-field.d.ts.map +1 -1
- package/dist/s-text-field/s-text-field.js +10 -23
- package/dist/s-text-shimmer/s-text-shimmer.d.ts +0 -14
- package/dist/s-text-shimmer/s-text-shimmer.d.ts.map +1 -1
- package/dist/s-text-shimmer/s-text-shimmer.js +28 -46
- package/dist/s-text-truncation/s-text-truncation.d.ts +4 -7
- package/dist/s-text-truncation/s-text-truncation.d.ts.map +1 -1
- package/dist/s-text-truncation/s-text-truncation.js +74 -34
- package/dist/s-tip/s-tip.d.ts +0 -1
- package/dist/s-tip/s-tip.d.ts.map +1 -1
- package/dist/s-tip/s-tip.js +9 -16
- package/dist/s-tooltip/index.d.ts +2 -0
- package/dist/s-tooltip/index.d.ts.map +1 -0
- package/dist/s-tooltip/index.js +1 -0
- package/dist/s-tooltip/s-tooltip.d.ts +23 -0
- package/dist/s-tooltip/s-tooltip.d.ts.map +1 -0
- package/dist/s-tooltip/s-tooltip.js +17 -0
- package/dist/s-zoom-image/s-zoom-image.d.ts +3 -5
- package/dist/s-zoom-image/s-zoom-image.d.ts.map +1 -1
- package/dist/s-zoom-image/s-zoom-image.js +16 -21
- package/dist/theme/theme-primitives.d.ts +10 -0
- package/dist/theme/theme-primitives.d.ts.map +1 -1
- package/dist/theme/theme-primitives.js +11 -0
- package/dist/utils/bytes-to-size.d.ts +0 -1
- package/dist/utils/bytes-to-size.d.ts.map +1 -1
- package/dist/utils/bytes-to-size.js +0 -1
- package/package.json +3 -2
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Color from 'color';
|
|
3
3
|
import React, { useEffect, useState } from 'react';
|
|
4
|
-
import { Animated, Platform, Pressable,
|
|
4
|
+
import { Animated, Platform, Pressable, View } from 'react-native';
|
|
5
5
|
import { RadioButton } from 'react-native-paper';
|
|
6
6
|
import { useSTheme } from '../theme';
|
|
7
7
|
/**
|
|
8
8
|
* A selectable list component with radio buttons and optional expandable content.
|
|
9
|
-
* Synced with web SSelectList from @solostylist/ui-kit.
|
|
10
9
|
*/
|
|
11
10
|
export const SSelectList = ({ items, selectedId, onSelect, renderItem, renderBelow, showRadio = true, style, }) => {
|
|
12
11
|
const { theme } = useSTheme();
|
|
@@ -31,39 +30,12 @@ export const SSelectList = ({ items, selectedId, onSelect, renderItem, renderBel
|
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
32
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
itemBox: {
|
|
42
|
-
flexDirection: 'row',
|
|
43
|
-
alignItems: 'center',
|
|
44
|
-
justifyContent: 'space-between',
|
|
45
|
-
borderRadius: theme.borderRadius.md, // 8px to match web
|
|
46
|
-
paddingVertical: theme.spacing.sm, // MUI spacing(1) = 8px
|
|
47
|
-
paddingLeft: theme.spacing.md, // MUI spacing(2) = 16px
|
|
48
|
-
paddingRight: theme.spacing.md,
|
|
49
|
-
borderWidth: 1,
|
|
50
|
-
borderStyle: 'solid',
|
|
51
|
-
},
|
|
52
|
-
itemContent: {
|
|
53
|
-
flexDirection: 'row',
|
|
54
|
-
alignItems: 'center',
|
|
55
|
-
gap: theme.spacing.md, // MUI gap: 2 = 16px
|
|
56
|
-
flex: 1,
|
|
57
|
-
borderRadius: theme.borderRadius.md,
|
|
58
|
-
},
|
|
59
|
-
belowContent: {
|
|
60
|
-
marginTop: theme.spacing.md, // MUI mt={2} = 16px
|
|
61
|
-
},
|
|
62
|
-
radio: {
|
|
63
|
-
marginLeft: theme.spacing.xs,
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
return (_jsx(View, { style: [styles.container, style], children: items.map((item, index) => {
|
|
33
|
+
return (_jsx(View, { style: [
|
|
34
|
+
{
|
|
35
|
+
gap: theme.spacing.md,
|
|
36
|
+
},
|
|
37
|
+
style,
|
|
38
|
+
], children: items.map((item, index) => {
|
|
67
39
|
const isSelected = item.id === selectedId;
|
|
68
40
|
const hasBelowContent = renderBelow && isSelected;
|
|
69
41
|
const isExpanded = expandedItems[item.id] ?? false;
|
|
@@ -80,17 +52,31 @@ export const SSelectList = ({ items, selectedId, onSelect, renderItem, renderBel
|
|
|
80
52
|
? Color(theme.colors.secondary[600]).alpha(0.1).rgb().string()
|
|
81
53
|
: Color(theme.colors.secondary[300]).alpha(0.1).rgb().string()
|
|
82
54
|
: 'transparent';
|
|
83
|
-
return (_jsxs(View, { style:
|
|
55
|
+
return (_jsxs(View, { style: { width: '100%' }, children: [_jsxs(Pressable, { onPress: () => handleSelect(item.id), onPressIn: () => setHoveredIndex(index), onPressOut: () => setHoveredIndex(null), ...(Platform.OS === 'web' && {
|
|
84
56
|
onMouseEnter: () => setHoveredIndex(index),
|
|
85
57
|
onMouseLeave: () => setHoveredIndex(null),
|
|
86
58
|
}), style: ({ pressed }) => [
|
|
87
|
-
styles.itemBox,
|
|
88
59
|
{
|
|
60
|
+
flexDirection: 'row',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
justifyContent: 'space-between',
|
|
63
|
+
borderRadius: theme.borderRadius.md,
|
|
64
|
+
paddingVertical: theme.spacing.sm,
|
|
65
|
+
paddingLeft: theme.spacing.md,
|
|
66
|
+
paddingRight: theme.spacing.md,
|
|
67
|
+
borderWidth: 1,
|
|
68
|
+
borderStyle: 'solid',
|
|
89
69
|
borderColor,
|
|
90
70
|
backgroundColor: pressed ? backgroundColor : backgroundColor,
|
|
91
71
|
cursor: 'pointer',
|
|
92
72
|
},
|
|
93
|
-
], children: [_jsx(View, { style:
|
|
73
|
+
], children: [_jsx(View, { style: {
|
|
74
|
+
flexDirection: 'row',
|
|
75
|
+
alignItems: 'center',
|
|
76
|
+
gap: theme.spacing.md,
|
|
77
|
+
flex: 1,
|
|
78
|
+
borderRadius: theme.borderRadius.md,
|
|
79
|
+
}, children: renderItem(item, isSelected) }), showRadio && (_jsx(RadioButton.Android, { value: item.id, status: isSelected ? 'checked' : 'unchecked', color: theme.dark ? theme.colors.primary[400] : theme.colors.primary[600], uncheckedColor: theme.colors.divider, style: { marginLeft: theme.spacing.xs } }))] }), hasBelowContent && _jsx(CollapseView, { isExpanded: isExpanded, children: renderBelow(item) })] }, item.id));
|
|
94
80
|
}) }));
|
|
95
81
|
};
|
|
96
82
|
const CollapseView = ({ isExpanded, children }) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/s-skeleton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SSkeleton, default } from './s-skeleton';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
/**
|
|
4
|
+
* Props interface for SSkeleton component
|
|
5
|
+
*/
|
|
6
|
+
export interface SSkeletonProps {
|
|
7
|
+
/** Visual variant of the skeleton */
|
|
8
|
+
variant?: 'circular' | 'rectangular' | 'rounded' | 'text';
|
|
9
|
+
/** Height of the skeleton (number for px, string for percentage/dimensions) */
|
|
10
|
+
height?: number | string;
|
|
11
|
+
/** Width of the skeleton (number for px, string for percentage/dimensions) */
|
|
12
|
+
width?: number | string;
|
|
13
|
+
/** Additional styles */
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
/** Pre-defined component preset for common UI elements */
|
|
16
|
+
component?: 'button' | 'checkbox' | 'radio-button' | 'avatar' | 'rounded-avatar' | 'icon-button' | 'typography' | 'title-typography';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* An enhanced skeleton loading component with pre-defined component presets for consistent loading states.
|
|
20
|
+
* Uses a pulse animation to mimic the web skeleton behavior.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SSkeleton: {
|
|
23
|
+
({ variant, width, height, style, component }: SSkeletonProps): React.JSX.Element;
|
|
24
|
+
displayName: string;
|
|
25
|
+
};
|
|
26
|
+
export default SSkeleton;
|
|
27
|
+
//# sourceMappingURL=s-skeleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s-skeleton.d.ts","sourceRoot":"","sources":["../../src/s-skeleton/s-skeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAAoC,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGhG;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,qCAAqC;IACrC,OAAO,CAAC,EAAE,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,MAAM,CAAC;IAC1D,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,wBAAwB;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,0DAA0D;IAC1D,SAAS,CAAC,EACN,QAAQ,GACR,UAAU,GACV,cAAc,GACd,QAAQ,GACR,gBAAgB,GAChB,aAAa,GACb,YAAY,GACZ,kBAAkB,CAAC;CACxB;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS;mDAA2D,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO;;CAwHlH,CAAC;AAIF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Animated, Easing } from 'react-native';
|
|
4
|
+
import { useSTheme } from '../theme';
|
|
5
|
+
/**
|
|
6
|
+
* An enhanced skeleton loading component with pre-defined component presets for consistent loading states.
|
|
7
|
+
* Uses a pulse animation to mimic the web skeleton behavior.
|
|
8
|
+
*/
|
|
9
|
+
export const SSkeleton = ({ variant = 'text', width, height, style, component }) => {
|
|
10
|
+
const { theme } = useSTheme();
|
|
11
|
+
// Pulse animation state
|
|
12
|
+
const [pulseAnim] = useState(() => new Animated.Value(0.4));
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const pulse = Animated.loop(Animated.sequence([
|
|
15
|
+
Animated.timing(pulseAnim, {
|
|
16
|
+
toValue: 1,
|
|
17
|
+
duration: 800,
|
|
18
|
+
easing: Easing.inOut(Easing.ease),
|
|
19
|
+
useNativeDriver: true,
|
|
20
|
+
}),
|
|
21
|
+
Animated.timing(pulseAnim, {
|
|
22
|
+
toValue: 0.4,
|
|
23
|
+
duration: 800,
|
|
24
|
+
easing: Easing.inOut(Easing.ease),
|
|
25
|
+
useNativeDriver: true,
|
|
26
|
+
}),
|
|
27
|
+
]));
|
|
28
|
+
pulse.start();
|
|
29
|
+
return () => pulse.stop();
|
|
30
|
+
}, [pulseAnim]);
|
|
31
|
+
// Determine actual dimensions and variant based on component prop if present
|
|
32
|
+
let finalVariant = variant;
|
|
33
|
+
let finalWidth;
|
|
34
|
+
let finalHeight;
|
|
35
|
+
if (component) {
|
|
36
|
+
switch (component) {
|
|
37
|
+
case 'button':
|
|
38
|
+
finalHeight = 36; // Matches native button height (small/medium avg)
|
|
39
|
+
finalVariant = 'rounded';
|
|
40
|
+
break;
|
|
41
|
+
case 'checkbox':
|
|
42
|
+
finalHeight = 24;
|
|
43
|
+
finalWidth = 24;
|
|
44
|
+
finalVariant = 'rounded';
|
|
45
|
+
break;
|
|
46
|
+
case 'radio-button':
|
|
47
|
+
finalHeight = 24;
|
|
48
|
+
finalWidth = 24;
|
|
49
|
+
finalVariant = 'circular';
|
|
50
|
+
break;
|
|
51
|
+
case 'avatar':
|
|
52
|
+
finalHeight = 54;
|
|
53
|
+
finalWidth = 54;
|
|
54
|
+
finalVariant = 'rectangular'; // Web uses rectangular for 'avatar' preset, likely intended for square avatar
|
|
55
|
+
break;
|
|
56
|
+
case 'rounded-avatar':
|
|
57
|
+
finalHeight = 48;
|
|
58
|
+
finalWidth = 48;
|
|
59
|
+
finalVariant = 'circular';
|
|
60
|
+
break;
|
|
61
|
+
case 'icon-button':
|
|
62
|
+
finalHeight = 32;
|
|
63
|
+
finalWidth = 32;
|
|
64
|
+
finalVariant = 'circular';
|
|
65
|
+
break;
|
|
66
|
+
case 'typography':
|
|
67
|
+
finalWidth = '100%';
|
|
68
|
+
finalVariant = 'text';
|
|
69
|
+
// Height will be determined by text variant logic below if not set
|
|
70
|
+
break;
|
|
71
|
+
case 'title-typography':
|
|
72
|
+
finalWidth = 200;
|
|
73
|
+
finalVariant = 'text';
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Apply prop overrides if provided (taking precedence over component presets)
|
|
78
|
+
if (width !== undefined)
|
|
79
|
+
finalWidth = width;
|
|
80
|
+
if (height !== undefined)
|
|
81
|
+
finalHeight = height;
|
|
82
|
+
// Set defaults if not set by component or props
|
|
83
|
+
if (finalWidth === undefined)
|
|
84
|
+
finalWidth = '100%';
|
|
85
|
+
if (finalHeight === undefined) {
|
|
86
|
+
if (finalVariant === 'text') {
|
|
87
|
+
finalHeight = 16; // Default text height
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
finalHeight = 32; // Default block height
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Calculate border radius based on variant
|
|
94
|
+
let borderRadius = 0;
|
|
95
|
+
if (finalVariant === 'circular') {
|
|
96
|
+
// For circular, try to use half of height or width if they are numbers
|
|
97
|
+
if (typeof finalHeight === 'number') {
|
|
98
|
+
borderRadius = finalHeight / 2;
|
|
99
|
+
}
|
|
100
|
+
else if (typeof finalWidth === 'number') {
|
|
101
|
+
borderRadius = finalWidth / 2;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
borderRadius = 9999; // Fallback for percentages
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else if (finalVariant === 'rounded') {
|
|
108
|
+
borderRadius = theme.borderRadius.md;
|
|
109
|
+
}
|
|
110
|
+
else if (finalVariant === 'text') {
|
|
111
|
+
borderRadius = theme.borderRadius.sm;
|
|
112
|
+
}
|
|
113
|
+
// rectangular stays 0
|
|
114
|
+
return (_jsx(Animated.View, { style: [
|
|
115
|
+
{
|
|
116
|
+
width: finalWidth,
|
|
117
|
+
height: finalHeight,
|
|
118
|
+
borderRadius,
|
|
119
|
+
backgroundColor: theme.dark ? theme.colors.secondary[700] : theme.colors.secondary[300],
|
|
120
|
+
opacity: pulseAnim,
|
|
121
|
+
},
|
|
122
|
+
style,
|
|
123
|
+
] }));
|
|
124
|
+
};
|
|
125
|
+
SSkeleton.displayName = 'SSkeleton';
|
|
126
|
+
export default SSkeleton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/s-switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SSwitch, default } from './s-switch';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { type SwitchProps } from 'react-native-paper';
|
|
4
|
+
/**
|
|
5
|
+
* Props interface for SSwitch component
|
|
6
|
+
*/
|
|
7
|
+
export interface SSwitchProps extends Omit<SwitchProps, 'theme'> {
|
|
8
|
+
/** Current toggle state (on/off) */
|
|
9
|
+
value: boolean;
|
|
10
|
+
/** Callback fired when switch state changes */
|
|
11
|
+
onValueChange: (value: boolean) => void;
|
|
12
|
+
/** Content displayed as a label next to the switch */
|
|
13
|
+
label?: string | React.ReactNode;
|
|
14
|
+
/** Whether the switch is disabled */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Additional styles for the switch container */
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
/** Additional styles for the label text */
|
|
19
|
+
labelStyle?: StyleProp<ViewStyle>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A toggle switch component for binary on/off state selection.
|
|
23
|
+
* Built on React Native Paper Switch with consistent theming.
|
|
24
|
+
*/
|
|
25
|
+
export declare const SSwitch: {
|
|
26
|
+
({ value, onValueChange, label, disabled, style, labelStyle, ...props }: SSwitchProps): React.JSX.Element;
|
|
27
|
+
displayName: string;
|
|
28
|
+
};
|
|
29
|
+
export default SSwitch;
|
|
30
|
+
//# sourceMappingURL=s-switch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s-switch.d.ts","sourceRoot":"","sources":["../../src/s-switch/s-switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAa,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAI9D;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9D,oCAAoC;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACjC,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iDAAiD;IACjD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,2CAA2C;IAC3C,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACnC;AAED;;;GAGG;AACH,eAAO,MAAM,OAAO;6EAQjB,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO;;CAyDlC,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { Pressable } from 'react-native';
|
|
4
|
+
import { Switch } from 'react-native-paper';
|
|
5
|
+
import { SText } from '../s-text';
|
|
6
|
+
import { useSTheme } from '../theme';
|
|
7
|
+
/**
|
|
8
|
+
* A toggle switch component for binary on/off state selection.
|
|
9
|
+
* Built on React Native Paper Switch with consistent theming.
|
|
10
|
+
*/
|
|
11
|
+
export const SSwitch = ({ value = false, onValueChange, label, disabled = false, style, labelStyle, ...props }) => {
|
|
12
|
+
const { theme } = useSTheme();
|
|
13
|
+
// Calculate colors based on theme mode
|
|
14
|
+
const colors = useMemo(() => {
|
|
15
|
+
const isDark = theme.dark;
|
|
16
|
+
// Track colors - on/off states
|
|
17
|
+
const trackColorOn = isDark ? theme.colors.primary[400] : theme.colors.primary[600];
|
|
18
|
+
const trackColorOff = isDark ? theme.colors.secondary[600] : theme.colors.secondary[400];
|
|
19
|
+
const disabledTrackColor = isDark ? theme.colors.secondary[700] : theme.colors.secondary[300];
|
|
20
|
+
// Label color
|
|
21
|
+
const labelColor = disabled ? theme.colors.text.disabled : theme.colors.text.primary;
|
|
22
|
+
return {
|
|
23
|
+
trackColorOn: disabled ? disabledTrackColor : trackColorOn,
|
|
24
|
+
trackColorOff: disabled ? disabledTrackColor : trackColorOff,
|
|
25
|
+
labelColor,
|
|
26
|
+
};
|
|
27
|
+
}, [theme.dark, theme.colors, disabled]);
|
|
28
|
+
const handleValueChange = (newValue) => {
|
|
29
|
+
if (!disabled && onValueChange) {
|
|
30
|
+
onValueChange(newValue);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return (_jsxs(Pressable, { style: [
|
|
34
|
+
{
|
|
35
|
+
flexDirection: 'row',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
justifyContent: 'space-between',
|
|
38
|
+
width: '100%',
|
|
39
|
+
},
|
|
40
|
+
style,
|
|
41
|
+
], onPress: () => handleValueChange(!value), disabled: disabled, children: [label && (_jsx(SText, { variant: "body2", style: [{ color: colors.labelColor }, labelStyle], children: label })), _jsx(Switch, { value: value, onValueChange: handleValueChange, disabled: disabled, color: colors.trackColorOn, ...props })] }));
|
|
42
|
+
};
|
|
43
|
+
SSwitch.displayName = 'SSwitch';
|
|
44
|
+
export default SSwitch;
|
|
@@ -3,7 +3,6 @@ import { type KeyboardTypeOptions } from 'react-native';
|
|
|
3
3
|
import { type TextInputProps } from 'react-native-paper';
|
|
4
4
|
/**
|
|
5
5
|
* Props interface for STextField component
|
|
6
|
-
* Synced with web STextField from @solostylist/ui-kit
|
|
7
6
|
*/
|
|
8
7
|
export interface STextFieldProps extends Omit<TextInputProps, 'error' | 'theme'> {
|
|
9
8
|
/** Field label displayed above the input */
|
|
@@ -43,7 +42,6 @@ export interface STextFieldProps extends Omit<TextInputProps, 'error' | 'theme'>
|
|
|
43
42
|
}
|
|
44
43
|
/**
|
|
45
44
|
* An enhanced text field component with integrated form labeling, error handling, and password visibility toggle.
|
|
46
|
-
* Synced with web STextField from @solostylist/ui-kit.
|
|
47
45
|
*/
|
|
48
46
|
export declare const STextField: {
|
|
49
47
|
({ label, placeholder, value, onChangeText, onBlur, error, required, type, disabled, keyboardType, maxLength, hint, multiline, numberOfLines, size, variant, autoFocus, ...props }: STextFieldProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s-text-field.d.ts","sourceRoot":"","sources":["../../src/s-text-field/s-text-field.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"s-text-field.d.ts","sourceRoot":"","sources":["../../src/s-text-field/s-text-field.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpE;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,OAAO,CAAC;IAC9E,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,CAAC;IAChE,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qCAAqC;IACrC,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0CAA0C;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yBAAyB;IACzB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,2BAA2B;IAC3B,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAC9B,qCAAqC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,UAAU;wLAmBpB,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO;;CAyFrC,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { StyleSheet } from 'react-native';
|
|
4
3
|
import { TextInput } from 'react-native-paper';
|
|
5
4
|
import { SForm } from '../s-form';
|
|
6
5
|
import { useSTheme } from '../theme';
|
|
7
6
|
/**
|
|
8
7
|
* An enhanced text field component with integrated form labeling, error handling, and password visibility toggle.
|
|
9
|
-
* Synced with web STextField from @solostylist/ui-kit.
|
|
10
8
|
*/
|
|
11
9
|
export const STextField = ({ label, placeholder, value, onChangeText, onBlur, error, required = false, type = 'text', disabled = false, keyboardType, maxLength, hint, multiline = false, numberOfLines, size = 'medium', variant = 'outlined', autoFocus = false, ...props }) => {
|
|
12
10
|
const { theme } = useSTheme();
|
|
@@ -39,31 +37,20 @@ export const STextField = ({ label, placeholder, value, onChangeText, onBlur, er
|
|
|
39
37
|
const handleTogglePasswordVisibility = () => {
|
|
40
38
|
setIsPasswordVisible(!isPasswordVisible);
|
|
41
39
|
};
|
|
42
|
-
const styles = StyleSheet.create({
|
|
43
|
-
input: {
|
|
44
|
-
// Match web sizes: small = 36px (2.25rem), medium = 40px (2.5rem)
|
|
45
|
-
...(size === 'small' && !multiline
|
|
46
|
-
? {
|
|
47
|
-
height: 36,
|
|
48
|
-
}
|
|
49
|
-
: size === 'medium' && !multiline
|
|
50
|
-
? {
|
|
51
|
-
height: 40,
|
|
52
|
-
}
|
|
53
|
-
: {}),
|
|
54
|
-
},
|
|
55
|
-
content: {
|
|
56
|
-
// contentStyle is used for text content styling (input text and placeholder)
|
|
57
|
-
fontFamily: theme.typography.fontFamily,
|
|
58
|
-
// fontSize controls both input text and placeholder text size
|
|
59
|
-
fontSize: size === 'small' ? theme.typography.fontSize.sm : theme.typography.fontSize.md,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
40
|
const inputType = isPassword && isPasswordVisible ? 'text' : type;
|
|
63
41
|
const secureTextEntry = inputType === 'password';
|
|
64
42
|
// Extract left prop from props if provided (for start icon support)
|
|
65
43
|
const { left, ...restProps } = props;
|
|
66
|
-
return (_jsx(SForm, { label: label, hint: hint, error: error, required: required, children: _jsx(TextInput, { mode: variant, placeholder: placeholder, placeholderTextColor: theme.colors.divider, value: value, onChangeText: onChangeText, onBlur: onBlur, error: !!error, disabled: disabled, secureTextEntry: secureTextEntry, keyboardType: getKeyboardType(), autoCapitalize: getAutoCapitalize(), maxLength: maxLength, multiline: multiline, numberOfLines: numberOfLines, autoFocus: autoFocus, dense: size === 'small', left: left, right: isPassword ? (_jsx(TextInput.Icon, { icon: isPasswordVisible ? 'eye-off' : 'eye', onPress: handleTogglePasswordVisibility, forceTextInputFocus: false, size: theme.iconSize.xs })) : undefined,
|
|
44
|
+
return (_jsx(SForm, { label: label, hint: hint, error: error, required: required, children: _jsx(TextInput, { mode: variant, placeholder: placeholder, placeholderTextColor: theme.colors.divider, value: value, onChangeText: onChangeText, onBlur: onBlur, error: !!error, disabled: disabled, secureTextEntry: secureTextEntry, keyboardType: getKeyboardType(), autoCapitalize: getAutoCapitalize(), maxLength: maxLength, multiline: multiline, numberOfLines: numberOfLines, autoFocus: autoFocus, dense: size === 'small', left: left, right: isPassword ? (_jsx(TextInput.Icon, { icon: isPasswordVisible ? 'eye-off' : 'eye', onPress: handleTogglePasswordVisibility, forceTextInputFocus: false, size: theme.iconSize.xs })) : undefined, ...restProps, style: {
|
|
45
|
+
...(!multiline && { height: theme.typography.input.height[size] }),
|
|
46
|
+
...props.style,
|
|
47
|
+
}, contentStyle: {
|
|
48
|
+
fontFamily: theme.typography.fontFamily,
|
|
49
|
+
fontSize: theme.typography.input.fontSize[size],
|
|
50
|
+
...props.contentStyle,
|
|
51
|
+
}, outlineStyle: disabled && variant === 'outlined'
|
|
52
|
+
? { borderColor: theme.colors.divider, ...props.outlineStyle }
|
|
53
|
+
: props.outlineStyle }) }));
|
|
67
54
|
};
|
|
68
55
|
STextField.displayName = 'STextField';
|
|
69
56
|
export default STextField;
|
|
@@ -13,20 +13,6 @@ export interface STextShimmerProps extends Omit<STextProps, 'children'> {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* A text component that creates an animated shimmer effect.
|
|
16
|
-
* Synced with web STextShimmer from @solostylist/ui-kit.
|
|
17
|
-
*
|
|
18
|
-
* Web implementation details:
|
|
19
|
-
* - Uses CSS linear-gradient with background-clip: text
|
|
20
|
-
* - backgroundSize: '250% 100%' (gradient is 2.5x container width)
|
|
21
|
-
* - Gradient pattern: transparent → (50% - spread) → primary color → (50% + spread) → transparent
|
|
22
|
-
* - Animates background-position from 100% (right) to 0% (left)
|
|
23
|
-
* - Base color: text.disabled, Highlight color: text.primary
|
|
24
|
-
*
|
|
25
|
-
* React Native implementation:
|
|
26
|
-
* - Uses layered text with Animated.View
|
|
27
|
-
* - Base layer: text.disabled (always visible)
|
|
28
|
-
* - Highlight layer: text.primary with moving clip window
|
|
29
|
-
* - Matches web's animation direction, duration, and spread behavior
|
|
30
16
|
*/
|
|
31
17
|
export declare const STextShimmer: {
|
|
32
18
|
({ children, duration, spread, variant, style, ...textProps }: STextShimmerProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s-text-shimmer.d.ts","sourceRoot":"","sources":["../../src/s-text-shimmer/s-text-shimmer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAS,UAAU,EAAE,MAAM,WAAW,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC;IACrE,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED
|
|
1
|
+
{"version":3,"file":"s-text-shimmer.d.ts","sourceRoot":"","sources":["../../src/s-text-shimmer/s-text-shimmer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAS,UAAU,EAAE,MAAM,WAAW,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC;IACrE,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY;mEAOtB,iBAAiB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO;;CAuIvC,CAAC;AAIF,eAAe,YAAY,CAAC"}
|
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { Animated, Easing,
|
|
3
|
+
import { Animated, Easing, View } from 'react-native';
|
|
4
4
|
import { SText } from '../s-text';
|
|
5
5
|
/**
|
|
6
6
|
* A text component that creates an animated shimmer effect.
|
|
7
|
-
* Synced with web STextShimmer from @solostylist/ui-kit.
|
|
8
|
-
*
|
|
9
|
-
* Web implementation details:
|
|
10
|
-
* - Uses CSS linear-gradient with background-clip: text
|
|
11
|
-
* - backgroundSize: '250% 100%' (gradient is 2.5x container width)
|
|
12
|
-
* - Gradient pattern: transparent → (50% - spread) → primary color → (50% + spread) → transparent
|
|
13
|
-
* - Animates background-position from 100% (right) to 0% (left)
|
|
14
|
-
* - Base color: text.disabled, Highlight color: text.primary
|
|
15
|
-
*
|
|
16
|
-
* React Native implementation:
|
|
17
|
-
* - Uses layered text with Animated.View
|
|
18
|
-
* - Base layer: text.disabled (always visible)
|
|
19
|
-
* - Highlight layer: text.primary with moving clip window
|
|
20
|
-
* - Matches web's animation direction, duration, and spread behavior
|
|
21
7
|
*/
|
|
22
8
|
export const STextShimmer = ({ children, duration = 2, spread = 2, variant = 'body1', style, ...textProps }) => {
|
|
23
9
|
// Animated value for shimmer position (0 to 1)
|
|
@@ -84,37 +70,33 @@ export const STextShimmer = ({ children, duration = 2, spread = 2, variant = 'bo
|
|
|
84
70
|
inputRange: [0, 1],
|
|
85
71
|
outputRange: [highlightWidth, -textWidth],
|
|
86
72
|
});
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
], children: _jsx(Animated.View, { style: {
|
|
115
|
-
width: textWidth,
|
|
116
|
-
transform: [{ translateX: textOffsetX }],
|
|
117
|
-
}, children: _jsx(SText, { variant: variant, color: "text.primary", ...textProps, children: children }) }) }) }))] }) }));
|
|
73
|
+
return (_jsxs(View, { style: [
|
|
74
|
+
{
|
|
75
|
+
overflow: 'hidden',
|
|
76
|
+
position: 'relative',
|
|
77
|
+
},
|
|
78
|
+
style,
|
|
79
|
+
], onLayout: handleLayout, children: [_jsx(SText, { variant: variant, color: "text.disabled", ...textProps, children: children }), textWidth > 0 && (_jsx(View, { style: {
|
|
80
|
+
position: 'absolute',
|
|
81
|
+
top: 0,
|
|
82
|
+
left: 0,
|
|
83
|
+
right: 0,
|
|
84
|
+
bottom: 0,
|
|
85
|
+
overflow: 'hidden',
|
|
86
|
+
}, children: _jsx(Animated.View, { style: [
|
|
87
|
+
{
|
|
88
|
+
position: 'absolute',
|
|
89
|
+
top: 0,
|
|
90
|
+
overflow: 'hidden',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
width: highlightWidth,
|
|
94
|
+
transform: [{ translateX: highlightPositionX }],
|
|
95
|
+
},
|
|
96
|
+
], children: _jsx(Animated.View, { style: {
|
|
97
|
+
width: textWidth,
|
|
98
|
+
transform: [{ translateX: textOffsetX }],
|
|
99
|
+
}, children: _jsx(SText, { variant: variant, color: "text.primary", ...textProps, children: children }) }) }) }))] }));
|
|
118
100
|
};
|
|
119
101
|
STextShimmer.displayName = 'STextShimmer';
|
|
120
102
|
export default STextShimmer;
|
|
@@ -3,12 +3,11 @@ import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
|
|
|
3
3
|
/**
|
|
4
4
|
* Display variant for STextTruncation
|
|
5
5
|
* - 'expandable': Shows See more/less link to toggle text expansion
|
|
6
|
-
* - 'tooltip': Shows ellipsis
|
|
6
|
+
* - 'tooltip': Shows ellipsis with tooltip on long press
|
|
7
7
|
*/
|
|
8
8
|
export type STextTruncationVariant = 'expandable' | 'tooltip';
|
|
9
9
|
/**
|
|
10
10
|
* Props interface for STextTruncation component
|
|
11
|
-
* Synced with web STextTruncation from @solostylist/ui-kit
|
|
12
11
|
*/
|
|
13
12
|
export interface STextTruncationProps {
|
|
14
13
|
/** The text content to display and potentially truncate */
|
|
@@ -21,8 +20,6 @@ export interface STextTruncationProps {
|
|
|
21
20
|
seeMoreText?: string;
|
|
22
21
|
/** Text to show for collapsing (default: 'See less') */
|
|
23
22
|
seeLessText?: string;
|
|
24
|
-
/** Minimum word count to show toggle link (default: 20) */
|
|
25
|
-
minWordsForToggle?: number;
|
|
26
23
|
/** Additional styles for the container */
|
|
27
24
|
style?: StyleProp<ViewStyle>;
|
|
28
25
|
/** Additional styles for the text */
|
|
@@ -34,11 +31,11 @@ export interface STextTruncationProps {
|
|
|
34
31
|
}
|
|
35
32
|
/**
|
|
36
33
|
* A text truncation component with expandable See more/less functionality.
|
|
37
|
-
*
|
|
38
|
-
*
|
|
34
|
+
* Uses JS-based binary search truncation so "See more/less" appears inline
|
|
35
|
+
* at the end of the last line, matching the web ui-kit behavior.
|
|
39
36
|
*/
|
|
40
37
|
export declare const STextTruncation: {
|
|
41
|
-
({ text, variant, lines, seeMoreText, seeLessText,
|
|
38
|
+
({ text, variant, lines, seeMoreText, seeLessText, style, textStyle, linkStyle, onExpandChange, }: STextTruncationProps): React.JSX.Element;
|
|
42
39
|
displayName: string;
|
|
43
40
|
};
|
|
44
41
|
export default STextTruncation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s-text-truncation.d.ts","sourceRoot":"","sources":["../../src/s-text-truncation/s-text-truncation.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"s-text-truncation.d.ts","sourceRoot":"","sources":["../../src/s-text-truncation/s-text-truncation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,YAAY,GAAG,SAAS,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4FAA4F;IAC5F,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,qCAAqC;IACrC,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,4CAA4C;IAC5C,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,4CAA4C;IAC5C,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe;uGAUzB,oBAAoB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO;;CAmH1C,CAAC;AAIF,eAAe,eAAe,CAAC"}
|