@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.
Files changed (150) hide show
  1. package/dist/hooks/use-count-down.d.ts +0 -2
  2. package/dist/hooks/use-count-down.d.ts.map +1 -1
  3. package/dist/hooks/use-count-down.js +0 -1
  4. package/dist/index.d.ts +5 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +4 -0
  7. package/dist/s-avatar/s-avatar.d.ts +4 -8
  8. package/dist/s-avatar/s-avatar.d.ts.map +1 -1
  9. package/dist/s-avatar/s-avatar.js +49 -42
  10. package/dist/s-button/s-button.d.ts +0 -2
  11. package/dist/s-button/s-button.d.ts.map +1 -1
  12. package/dist/s-button/s-button.js +27 -24
  13. package/dist/s-button-link/s-button-link.d.ts +0 -2
  14. package/dist/s-button-link/s-button-link.d.ts.map +1 -1
  15. package/dist/s-button-link/s-button-link.js +21 -26
  16. package/dist/s-chat-input/index.d.ts +1 -1
  17. package/dist/s-chat-input/index.d.ts.map +1 -1
  18. package/dist/s-chat-input/s-chat-input.d.ts +19 -8
  19. package/dist/s-chat-input/s-chat-input.d.ts.map +1 -1
  20. package/dist/s-chat-input/s-chat-input.js +115 -46
  21. package/dist/s-chat-message/s-chat-message.d.ts +5 -7
  22. package/dist/s-chat-message/s-chat-message.d.ts.map +1 -1
  23. package/dist/s-chat-message/s-chat-message.js +100 -175
  24. package/dist/s-checkbox/s-checkbox.d.ts +0 -2
  25. package/dist/s-checkbox/s-checkbox.d.ts.map +1 -1
  26. package/dist/s-checkbox/s-checkbox.js +11 -18
  27. package/dist/s-chip/s-chip.d.ts +0 -2
  28. package/dist/s-chip/s-chip.d.ts.map +1 -1
  29. package/dist/s-chip/s-chip.js +35 -54
  30. package/dist/s-code-block/s-code-block.d.ts +0 -2
  31. package/dist/s-code-block/s-code-block.d.ts.map +1 -1
  32. package/dist/s-code-block/s-code-block.js +28 -40
  33. package/dist/s-comment-message/s-comment-message.d.ts +3 -5
  34. package/dist/s-comment-message/s-comment-message.d.ts.map +1 -1
  35. package/dist/s-comment-message/s-comment-message.js +54 -167
  36. package/dist/s-copyable-text/s-copyable-text.d.ts +0 -2
  37. package/dist/s-copyable-text/s-copyable-text.d.ts.map +1 -1
  38. package/dist/s-copyable-text/s-copyable-text.js +20 -45
  39. package/dist/s-countdown/index.d.ts +0 -1
  40. package/dist/s-countdown/index.d.ts.map +1 -1
  41. package/dist/s-countdown/index.js +0 -1
  42. package/dist/s-countdown/s-count-box.d.ts +5 -3
  43. package/dist/s-countdown/s-count-box.d.ts.map +1 -1
  44. package/dist/s-countdown/s-count-box.js +69 -60
  45. package/dist/s-countdown/s-countdown.d.ts +6 -3
  46. package/dist/s-countdown/s-countdown.d.ts.map +1 -1
  47. package/dist/s-countdown/s-countdown.js +11 -10
  48. package/dist/s-data-table/s-data-table.d.ts +0 -3
  49. package/dist/s-data-table/s-data-table.d.ts.map +1 -1
  50. package/dist/s-data-table/s-data-table.js +27 -50
  51. package/dist/s-date-picker/s-date-picker.d.ts +0 -2
  52. package/dist/s-date-picker/s-date-picker.d.ts.map +1 -1
  53. package/dist/s-date-picker/s-date-picker.js +51 -110
  54. package/dist/s-date-time-picker/s-date-time-picker.d.ts +0 -2
  55. package/dist/s-date-time-picker/s-date-time-picker.d.ts.map +1 -1
  56. package/dist/s-date-time-picker/s-date-time-picker.js +111 -203
  57. package/dist/s-divider/index.d.ts +2 -0
  58. package/dist/s-divider/index.d.ts.map +1 -0
  59. package/dist/s-divider/index.js +1 -0
  60. package/dist/s-divider/s-divider.d.ts +24 -0
  61. package/dist/s-divider/s-divider.d.ts.map +1 -0
  62. package/dist/s-divider/s-divider.js +30 -0
  63. package/dist/s-file-dropzone/s-file-dropzone.d.ts +0 -35
  64. package/dist/s-file-dropzone/s-file-dropzone.d.ts.map +1 -1
  65. package/dist/s-file-dropzone/s-file-dropzone.js +46 -120
  66. package/dist/s-file-icon/s-file-icon.d.ts +0 -2
  67. package/dist/s-file-icon/s-file-icon.d.ts.map +1 -1
  68. package/dist/s-file-icon/s-file-icon.js +11 -12
  69. package/dist/s-form/s-form.d.ts +0 -1
  70. package/dist/s-form/s-form.d.ts.map +1 -1
  71. package/dist/s-form/s-form.js +0 -1
  72. package/dist/s-icon-button/s-icon-button.d.ts +9 -9
  73. package/dist/s-icon-button/s-icon-button.d.ts.map +1 -1
  74. package/dist/s-icon-button/s-icon-button.js +38 -4
  75. package/dist/s-image-comparison/s-image-comparison.d.ts +3 -5
  76. package/dist/s-image-comparison/s-image-comparison.d.ts.map +1 -1
  77. package/dist/s-image-comparison/s-image-comparison.js +75 -102
  78. package/dist/s-label/s-label.d.ts +0 -1
  79. package/dist/s-label/s-label.d.ts.map +1 -1
  80. package/dist/s-label/s-label.js +8 -24
  81. package/dist/s-language-switcher/s-language-switcher.d.ts +2 -5
  82. package/dist/s-language-switcher/s-language-switcher.d.ts.map +1 -1
  83. package/dist/s-language-switcher/s-language-switcher.js +14 -25
  84. package/dist/s-lazy-image/s-lazy-image.d.ts +4 -6
  85. package/dist/s-lazy-image/s-lazy-image.d.ts.map +1 -1
  86. package/dist/s-lazy-image/s-lazy-image.js +37 -34
  87. package/dist/s-moving-border/s-moving-border.d.ts +0 -2
  88. package/dist/s-moving-border/s-moving-border.d.ts.map +1 -1
  89. package/dist/s-moving-border/s-moving-border.js +19 -24
  90. package/dist/s-multi-select/s-multi-select.d.ts +0 -2
  91. package/dist/s-multi-select/s-multi-select.d.ts.map +1 -1
  92. package/dist/s-multi-select/s-multi-select.js +54 -105
  93. package/dist/s-pagination/s-pagination.d.ts +12 -6
  94. package/dist/s-pagination/s-pagination.d.ts.map +1 -1
  95. package/dist/s-pagination/s-pagination.js +69 -43
  96. package/dist/s-rating/s-rating.d.ts +0 -2
  97. package/dist/s-rating/s-rating.d.ts.map +1 -1
  98. package/dist/s-rating/s-rating.js +31 -29
  99. package/dist/s-review/s-review.d.ts +6 -8
  100. package/dist/s-review/s-review.d.ts.map +1 -1
  101. package/dist/s-review/s-review.js +66 -153
  102. package/dist/s-scroll-to-top/s-scroll-to-top.d.ts +0 -2
  103. package/dist/s-scroll-to-top/s-scroll-to-top.d.ts.map +1 -1
  104. package/dist/s-scroll-to-top/s-scroll-to-top.js +17 -32
  105. package/dist/s-select/s-select.d.ts +5 -5
  106. package/dist/s-select/s-select.d.ts.map +1 -1
  107. package/dist/s-select/s-select.js +54 -94
  108. package/dist/s-select-list/s-select-list.d.ts +0 -2
  109. package/dist/s-select-list/s-select-list.d.ts.map +1 -1
  110. package/dist/s-select-list/s-select-list.js +24 -38
  111. package/dist/s-skeleton/index.d.ts +3 -0
  112. package/dist/s-skeleton/index.d.ts.map +1 -0
  113. package/dist/s-skeleton/index.js +1 -0
  114. package/dist/s-skeleton/s-skeleton.d.ts +27 -0
  115. package/dist/s-skeleton/s-skeleton.d.ts.map +1 -0
  116. package/dist/s-skeleton/s-skeleton.js +126 -0
  117. package/dist/s-switch/index.d.ts +3 -0
  118. package/dist/s-switch/index.d.ts.map +1 -0
  119. package/dist/s-switch/index.js +1 -0
  120. package/dist/s-switch/s-switch.d.ts +30 -0
  121. package/dist/s-switch/s-switch.d.ts.map +1 -0
  122. package/dist/s-switch/s-switch.js +44 -0
  123. package/dist/s-text-field/s-text-field.d.ts +0 -2
  124. package/dist/s-text-field/s-text-field.d.ts.map +1 -1
  125. package/dist/s-text-field/s-text-field.js +10 -23
  126. package/dist/s-text-shimmer/s-text-shimmer.d.ts +0 -14
  127. package/dist/s-text-shimmer/s-text-shimmer.d.ts.map +1 -1
  128. package/dist/s-text-shimmer/s-text-shimmer.js +28 -46
  129. package/dist/s-text-truncation/s-text-truncation.d.ts +4 -7
  130. package/dist/s-text-truncation/s-text-truncation.d.ts.map +1 -1
  131. package/dist/s-text-truncation/s-text-truncation.js +74 -34
  132. package/dist/s-tip/s-tip.d.ts +0 -1
  133. package/dist/s-tip/s-tip.d.ts.map +1 -1
  134. package/dist/s-tip/s-tip.js +9 -16
  135. package/dist/s-tooltip/index.d.ts +2 -0
  136. package/dist/s-tooltip/index.d.ts.map +1 -0
  137. package/dist/s-tooltip/index.js +1 -0
  138. package/dist/s-tooltip/s-tooltip.d.ts +23 -0
  139. package/dist/s-tooltip/s-tooltip.d.ts.map +1 -0
  140. package/dist/s-tooltip/s-tooltip.js +17 -0
  141. package/dist/s-zoom-image/s-zoom-image.d.ts +3 -5
  142. package/dist/s-zoom-image/s-zoom-image.d.ts.map +1 -1
  143. package/dist/s-zoom-image/s-zoom-image.js +16 -21
  144. package/dist/theme/theme-primitives.d.ts +10 -0
  145. package/dist/theme/theme-primitives.d.ts.map +1 -1
  146. package/dist/theme/theme-primitives.js +11 -0
  147. package/dist/utils/bytes-to-size.d.ts +0 -1
  148. package/dist/utils/bytes-to-size.d.ts.map +1 -1
  149. package/dist/utils/bytes-to-size.js +0 -1
  150. package/package.json +3 -2
@@ -1,66 +1,135 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import * as DocumentPicker from 'expo-document-picker';
2
3
  import { useState } from 'react';
3
- import { StyleSheet, View } from 'react-native';
4
- import { TextInput } from 'react-native-paper';
4
+ import { Image, View } from 'react-native';
5
+ import EmojiPicker from 'rn-emoji-keyboard';
6
+ import { SFileIcon } from '../s-file-icon';
5
7
  import { SIconButton } from '../s-icon-button';
8
+ import SText from '../s-text';
9
+ import { STextField } from '../s-text-field';
6
10
  import { useSTheme } from '../theme';
7
11
  /**
8
12
  * A chat input component with file attachment support, emoji picker, and multiline text input.
9
- * Synced with web SChatInput from @solostylist/ui-kit.
10
13
  */
11
- export const SChatInput = ({ value: controlledValue, onChangeText: controlledOnChangeText, onSubmit, placeholder = 'Enter your message here...', disabled = false, hideFileAttachment = false, hideEmojiPicker = false, onFileAttachmentPress, onEmojiPickerPress, minLines = 1, maxLines = 10, autoFocus = false, }) => {
14
+ export const SChatInput = ({ value: controlledValue, onChangeText: controlledOnChangeText, onSubmit, onFileSelect, placeholder = 'Enter your message here...', disabled = false, hideFileAttachment = false, hideEmojiPicker = false, acceptedFileTypes, minLines = 1, maxLines = 10, autoFocus = false, }) => {
12
15
  const { theme } = useSTheme();
13
16
  const [internalValue, setInternalValue] = useState('');
17
+ const [selectedFiles, setSelectedFiles] = useState([]);
18
+ const [emojiPickerOpen, setEmojiPickerOpen] = useState(false);
14
19
  // Use controlled value if provided, otherwise use internal state
15
20
  const inputValue = controlledValue !== undefined ? controlledValue : internalValue;
16
21
  const handleTextChange = controlledOnChangeText || setInternalValue;
22
+ const isImageFile = (mimeType) => {
23
+ return mimeType?.startsWith('image/') ?? false;
24
+ };
25
+ const handleFileSelect = async () => {
26
+ if (disabled)
27
+ return;
28
+ try {
29
+ const result = await DocumentPicker.getDocumentAsync({
30
+ type: acceptedFileTypes || '*/*',
31
+ multiple: true,
32
+ copyToCacheDirectory: true,
33
+ });
34
+ if (!result.canceled && result.assets) {
35
+ const newFiles = result.assets.map((asset) => ({
36
+ uri: asset.uri,
37
+ name: asset.name,
38
+ size: asset.size ?? undefined,
39
+ mimeType: asset.mimeType ?? undefined,
40
+ }));
41
+ setSelectedFiles((prev) => [...prev, ...newFiles]);
42
+ onFileSelect?.(newFiles);
43
+ }
44
+ }
45
+ catch (error) {
46
+ console.error('Error picking document:', error);
47
+ }
48
+ };
49
+ const handleRemoveFile = (index) => {
50
+ setSelectedFiles((prev) => prev.filter((_, i) => i !== index));
51
+ };
52
+ const handleEmojiSelect = (emoji) => {
53
+ const newValue = inputValue + emoji.emoji;
54
+ handleTextChange(newValue);
55
+ setEmojiPickerOpen(false);
56
+ };
17
57
  const handleSubmit = () => {
18
- if (disabled || inputValue.trim().length === 0)
58
+ if (disabled || (inputValue.trim().length === 0 && selectedFiles.length === 0))
19
59
  return;
20
- onSubmit?.(inputValue);
21
- // Clear input after submission if using internal state
60
+ onSubmit?.(inputValue, selectedFiles);
61
+ // Clear input and files after submission if using internal state
22
62
  if (controlledValue === undefined) {
23
63
  setInternalValue('');
24
64
  }
65
+ setSelectedFiles([]);
25
66
  };
26
- const styles = StyleSheet.create({
27
- container: {
28
- borderWidth: 1,
29
- borderColor: theme.colors.divider,
30
- borderRadius: theme.borderRadius.md,
31
- padding: 8,
32
- backgroundColor: theme.colors.background.paper,
33
- },
34
- inputContainer: {
35
- backgroundColor: 'transparent',
36
- },
37
- input: {
38
- backgroundColor: 'transparent',
39
- paddingHorizontal: 0,
40
- paddingVertical: 0,
41
- minHeight: minLines * 20,
42
- maxHeight: maxLines * 20,
43
- },
44
- content: {
45
- fontFamily: theme.typography.fontFamily,
46
- fontSize: theme.typography.fontSize.md,
47
- color: theme.colors.text.primary,
48
- },
49
- actionsContainer: {
50
- flexDirection: 'row',
51
- justifyContent: 'space-between',
52
- alignItems: 'center',
53
- marginTop: 8,
54
- },
55
- leftActions: {
56
- flexDirection: 'row',
57
- gap: 4,
58
- },
59
- iconButton: {
60
- margin: 0,
61
- },
62
- });
63
- return (_jsxs(View, { style: styles.container, children: [_jsx(TextInput, { mode: "flat", placeholder: placeholder, placeholderTextColor: theme.colors.divider, value: inputValue, onChangeText: handleTextChange, disabled: disabled, multiline: true, numberOfLines: minLines, autoFocus: autoFocus, style: styles.input, contentStyle: styles.content, underlineStyle: { display: 'none' }, activeUnderlineColor: "transparent", underlineColor: "transparent", textColor: theme.colors.text.primary }), _jsxs(View, { style: styles.actionsContainer, children: [_jsxs(View, { style: styles.leftActions, children: [!hideFileAttachment && (_jsx(SIconButton, { icon: "attachment", size: "medium", disabled: disabled, onPress: onFileAttachmentPress, style: styles.iconButton })), !hideEmojiPicker && (_jsx(SIconButton, { icon: "emoticon-happy-outline", size: "medium", disabled: disabled, onPress: onEmojiPickerPress, style: styles.iconButton }))] }), _jsx(SIconButton, { icon: "arrow-up", size: "medium", disabled: disabled || inputValue.trim().length === 0, onPress: handleSubmit, style: styles.iconButton, iconColor: disabled || inputValue.trim().length === 0 ? theme.colors.text.disabled : theme.colors.primary[500] })] })] }));
67
+ return (_jsxs(_Fragment, { children: [_jsxs(View, { style: {
68
+ borderWidth: 1,
69
+ borderColor: theme.colors.divider,
70
+ borderRadius: theme.borderRadius.lg,
71
+ backgroundColor: theme.colors.background.default,
72
+ }, children: [_jsx(STextField, { variant: "flat", placeholder: placeholder, value: inputValue, onChangeText: handleTextChange, disabled: disabled, multiline: true, numberOfLines: minLines, autoFocus: autoFocus, style: {
73
+ backgroundColor: 'transparent',
74
+ minHeight: minLines * 20,
75
+ maxHeight: maxLines * 20,
76
+ }, underlineStyle: { display: 'none' }, activeUnderlineColor: "transparent", underlineColor: "transparent", textColor: theme.colors.text.primary }), selectedFiles.length > 0 && (_jsx(View, { style: { paddingLeft: 16, paddingRight: 16 }, children: selectedFiles.map((file, index) => {
77
+ const isImage = isImageFile(file.mimeType);
78
+ const extension = file.name.split('.').pop();
79
+ return (_jsxs(View, { style: {
80
+ flexDirection: 'row',
81
+ alignItems: 'center',
82
+ justifyContent: 'space-between',
83
+ backgroundColor: theme.colors.background.paper,
84
+ borderWidth: 1,
85
+ borderColor: theme.colors.divider,
86
+ borderRadius: theme.borderRadius.sm,
87
+ padding: 8,
88
+ marginBottom: 4,
89
+ }, children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 8, flex: 1 }, children: [isImage ? (_jsx(Image, { source: { uri: file.uri }, style: {
90
+ width: 40,
91
+ height: 40,
92
+ borderRadius: theme.borderRadius.sm,
93
+ borderWidth: 1,
94
+ borderColor: theme.colors.divider,
95
+ }, resizeMode: "cover" })) : (_jsx(SFileIcon, { extension: extension, size: 40 })), _jsx(View, { style: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: 4 }, children: _jsxs(SText, { numberOfLines: 1, ellipsizeMode: "middle", style: { color: theme.colors.text.primary, flex: 1 }, children: [file.name, ' ', file.size && (_jsxs(SText, { variant: "caption", style: { color: theme.colors.text.secondary }, children: ["(", Math.round(file.size / 1024), " KB)"] }))] }) })] }), _jsx(SIconButton, { icon: "close", disabled: disabled, onPress: () => handleRemoveFile(index) })] }, `${file.name}-${index}`));
96
+ }) })), _jsxs(View, { style: {
97
+ flexDirection: 'row',
98
+ justifyContent: 'space-between',
99
+ alignItems: 'center',
100
+ marginTop: 8,
101
+ paddingHorizontal: 8,
102
+ }, children: [_jsxs(View, { style: {
103
+ flexDirection: 'row',
104
+ gap: 4,
105
+ }, children: [!hideFileAttachment && _jsx(SIconButton, { icon: "attachment", disabled: disabled, onPress: handleFileSelect }), !hideEmojiPicker && (_jsx(SIconButton, { icon: "emoticon-happy-outline", disabled: disabled, onPress: () => setEmojiPickerOpen(true) }))] }), _jsx(SIconButton, { icon: "arrow-up", disabled: disabled || (inputValue.trim().length === 0 && selectedFiles.length === 0), onPress: handleSubmit })] })] }), _jsx(EmojiPicker, { onEmojiSelected: handleEmojiSelect, open: emojiPickerOpen, onClose: () => setEmojiPickerOpen(false), theme: {
106
+ backdrop: theme.colors.blackAlpha.medium,
107
+ knob: theme.colors.divider,
108
+ container: theme.colors.background.paper,
109
+ header: theme.colors.text.primary,
110
+ skinTonesContainer: theme.colors.background.paper,
111
+ category: {
112
+ icon: theme.colors.text.secondary,
113
+ iconActive: theme.colors.primary.main,
114
+ container: 'transparent',
115
+ containerActive: theme.colors.whiteAlpha.light,
116
+ },
117
+ search: {
118
+ background: theme.colors.background.default,
119
+ text: theme.colors.text.primary,
120
+ placeholder: theme.colors.text.disabled,
121
+ icon: theme.colors.text.secondary,
122
+ },
123
+ customButton: {
124
+ icon: theme.colors.text.secondary,
125
+ iconPressed: theme.colors.primary.main,
126
+ background: 'transparent',
127
+ backgroundPressed: theme.colors.whiteAlpha.light,
128
+ },
129
+ emoji: {
130
+ selected: theme.colors.whiteAlpha.medium,
131
+ },
132
+ }, enableSearchBar: true, enableRecentlyUsed: true, categoryPosition: "top" })] }));
64
133
  };
65
134
  SChatInput.displayName = 'SChatInput';
66
135
  export default SChatInput;
@@ -1,17 +1,16 @@
1
1
  import React from 'react';
2
- import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
2
+ import { type ImageSourcePropType, type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
3
3
  export interface ChatAttachment {
4
4
  id: string;
5
5
  type: 'image' | 'file';
6
- url: string;
6
+ url: ImageSourcePropType;
7
7
  name?: string;
8
8
  size?: number;
9
9
  mimeType?: string;
10
- thumbnailUrl?: string;
10
+ thumbnailUrl?: ImageSourcePropType;
11
11
  }
12
12
  /**
13
13
  * Props interface for SChatMessage component
14
- * Synced with web SChatMessage from @solostylist/ui-kit
15
14
  */
16
15
  export interface SChatMessageProps {
17
16
  /** The message content to display in the chat bubble */
@@ -20,8 +19,8 @@ export interface SChatMessageProps {
20
19
  variant?: 'sent' | 'received';
21
20
  /** The timestamp for the message, displayed when showTimestamp is true */
22
21
  timestamp?: string | Date;
23
- /** Avatar image URL or base64 string to display next to the message */
24
- avatar?: string;
22
+ /** Avatar image URL or local asset to display next to the message */
23
+ avatar?: ImageSourcePropType;
25
24
  /** Name of the message sender, displayed above received messages when provided */
26
25
  senderName?: string;
27
26
  /** Whether to display the avatar next to the message */
@@ -53,7 +52,6 @@ export interface SChatMessageProps {
53
52
  }
54
53
  /**
55
54
  * A comprehensive chat message component for conversation interfaces with support for text, images, and file attachments.
56
- * Synced with web SChatMessage from @solostylist/ui-kit.
57
55
  */
58
56
  export declare const SChatMessage: {
59
57
  ({ message, variant, timestamp, avatar, senderName, showAvatar, showTimestamp, maxWidth, attachments, onAttachmentClick, onDownload, hasError, errorMessage, onRetry, loading, style, messageBubbleStyle, messageTextStyle, }: SChatMessageProps): React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"s-chat-message.d.ts","sourceRoot":"","sources":["../../src/s-chat-message/s-chat-message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA+B,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM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AAC,EAAE,OAAO,CAAC;IACxB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;IAC/B,mDAAmD;IACnD,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,IAAI,CAAC;IACzD,0DAA0D;IAC1D,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,IAAI,CAAC;IAClD,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,+CAA+C;IAC/C,kBAAkB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC1C,6CAA6C;IAC7C,gBAAgB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACzC;AAED;;GAEG;AACH,eAAO,MAAM,YAAY;mOAmBtB,iBAAiB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO;;CAqQvC,CAAC;AAIF,eAAe,YAAY,CAAC"}
@@ -1,31 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Pressable, StyleSheet, View } from 'react-native';
3
- import { IconButton, Text } from 'react-native-paper';
2
+ import { Pressable, View, } from 'react-native';
3
+ import { formatFileSize, formatTimestamp } from '@solostylist/core';
4
4
  import { SAvatar } from '../s-avatar';
5
+ import { SIconButton } from '../s-icon-button';
5
6
  import { SLazyImage } from '../s-lazy-image';
7
+ import { SSkeleton } from '../s-skeleton';
8
+ import { SText } from '../s-text';
6
9
  import { useSTheme } from '../theme';
7
10
  /**
8
11
  * A comprehensive chat message component for conversation interfaces with support for text, images, and file attachments.
9
- * Synced with web SChatMessage from @solostylist/ui-kit.
10
12
  */
11
13
  export const SChatMessage = ({ message, variant = 'received', timestamp, avatar, senderName, showAvatar = true, showTimestamp = false, maxWidth = 70, attachments = [], onAttachmentClick, onDownload, hasError = false, errorMessage = 'Failed to send message', onRetry, loading = false, style, messageBubbleStyle, messageTextStyle, }) => {
12
14
  const { theme } = useSTheme();
13
15
  const isSent = variant === 'sent';
14
- const formatTimestamp = (ts) => {
15
- const date = typeof ts === 'string' ? new Date(ts) : ts;
16
- return date.toLocaleTimeString('en-US', {
17
- hour: '2-digit',
18
- minute: '2-digit',
19
- hour12: true,
20
- });
21
- };
22
- const formatFileSize = (bytes) => {
23
- if (!bytes)
24
- return '';
25
- const sizes = ['Bytes', 'KB', 'MB', 'GB'];
26
- const i = Math.floor(Math.log(bytes) / Math.log(1024));
27
- return Math.round((bytes / Math.pow(1024, i)) * 100) / 100 + ' ' + sizes[i];
28
- };
29
16
  const handleImageClick = (attachment) => {
30
17
  if (onAttachmentClick) {
31
18
  onAttachmentClick(attachment);
@@ -41,167 +28,105 @@ export const SChatMessage = ({ message, variant = 'received', timestamp, avatar,
41
28
  };
42
29
  const imageAttachments = attachments.filter((a) => a.type === 'image');
43
30
  const fileAttachments = attachments.filter((a) => a.type === 'file');
44
- const styles = StyleSheet.create({
45
- container: {
46
- flexDirection: isSent ? 'row-reverse' : 'row',
47
- alignItems: 'flex-start',
48
- gap: theme.spacing.sm,
49
- marginBottom: theme.spacing.sm,
50
- maxWidth: `${maxWidth}%`,
51
- alignSelf: isSent ? 'flex-end' : 'flex-start',
52
- },
53
- contentColumn: {
54
- flexDirection: 'column',
55
- alignItems: isSent ? 'flex-end' : 'flex-start',
56
- gap: theme.spacing.xs,
57
- minWidth: 0,
58
- flex: 1,
59
- },
60
- senderName: {
61
- fontSize: theme.typography.fontSize.sm,
62
- fontFamily: theme.typography.fontFamily,
63
- color: theme.colors.text.primary,
64
- marginLeft: isSent ? 0 : theme.spacing.xs,
65
- marginRight: isSent ? theme.spacing.xs : 0,
66
- },
67
- messageBubble: {
68
- borderRadius: theme.borderRadius.md,
69
- maxWidth: '100%',
70
- borderWidth: 1,
71
- borderColor: hasError ? theme.colors.error.main : theme.colors.divider,
72
- overflow: 'hidden',
73
- opacity: hasError ? 0.7 : 1,
74
- },
75
- imagesGrid: {
76
- flexDirection: 'row',
77
- flexWrap: 'wrap',
78
- gap: theme.spacing.xs,
79
- padding: theme.spacing.xs,
80
- minWidth: 200,
81
- },
82
- imageContainer: {
83
- borderRadius: theme.borderRadius.sm,
84
- overflow: 'hidden',
85
- width: imageAttachments.length === 1 ? '100%' : '48%',
86
- aspectRatio: imageAttachments.length === 1 ? 1.5 : 1,
87
- },
88
- fileAttachmentsContainer: {
89
- padding: theme.spacing.md,
90
- },
91
- fileAttachment: {
92
- flexDirection: 'row',
93
- alignItems: 'center',
94
- gap: theme.spacing.md,
95
- padding: theme.spacing.sm,
96
- borderWidth: 1,
97
- borderColor: theme.colors.divider,
98
- borderRadius: theme.borderRadius.sm,
99
- },
100
- fileIcon: {
101
- width: 32,
102
- height: 32,
103
- backgroundColor: theme.colors.secondary[300],
104
- borderRadius: theme.borderRadius.sm,
105
- justifyContent: 'center',
106
- alignItems: 'center',
107
- },
108
- fileIconText: {
109
- fontSize: 10,
110
- fontWeight: '600',
111
- color: theme.colors.secondary[700],
112
- },
113
- fileInfo: {
114
- flex: 1,
115
- minWidth: 0,
116
- },
117
- fileName: {
118
- fontSize: theme.typography.fontSize.sm,
119
- fontWeight: '500',
120
- color: theme.colors.text.primary,
121
- },
122
- fileSize: {
123
- fontSize: theme.typography.fontSize.xs,
124
- color: theme.colors.text.secondary,
125
- },
126
- messageContent: {
127
- paddingHorizontal: theme.spacing.md,
128
- paddingVertical: theme.spacing.md,
129
- paddingTop: attachments.length > 0 ? 0 : theme.spacing.md,
130
- },
131
- messageText: {
132
- fontSize: theme.typography.fontSize.sm,
133
- fontFamily: theme.typography.fontFamily,
134
- color: hasError ? theme.colors.error.main : theme.colors.text.primary,
135
- },
136
- timestampText: {
137
- fontSize: theme.typography.fontSize.xs,
138
- color: theme.colors.text.secondary,
139
- marginLeft: isSent ? 0 : theme.spacing.xs,
140
- marginRight: isSent ? theme.spacing.xs : 0,
141
- },
142
- errorContainer: {
143
- flexDirection: 'row',
144
- alignItems: 'center',
145
- gap: theme.spacing.xs,
146
- },
147
- errorText: {
148
- fontSize: theme.typography.fontSize.xs,
149
- color: theme.colors.error.main,
150
- },
151
- skeletonContainer: {
152
- flexDirection: isSent ? 'row-reverse' : 'row',
153
- alignItems: 'flex-start',
154
- gap: theme.spacing.sm,
155
- marginBottom: theme.spacing.sm,
156
- maxWidth: `${maxWidth}%`,
157
- alignSelf: isSent ? 'flex-end' : 'flex-start',
158
- },
159
- skeletonAvatar: {
160
- width: 36,
161
- height: 36,
162
- borderRadius: 18,
163
- backgroundColor: theme.dark ? theme.colors.secondary[700] : theme.colors.secondary[300],
164
- },
165
- skeletonContent: {
166
- flex: 1,
167
- gap: theme.spacing.xs,
168
- },
169
- skeletonName: {
170
- width: 100,
171
- height: 12,
172
- borderRadius: theme.borderRadius.sm,
173
- backgroundColor: theme.dark ? theme.colors.secondary[700] : theme.colors.secondary[300],
174
- marginLeft: theme.spacing.xs,
175
- },
176
- skeletonMessage: {
177
- width: '100%',
178
- minWidth: 200,
179
- backgroundColor: theme.dark ? theme.colors.secondary[700] : theme.colors.secondary[300],
180
- borderRadius: theme.borderRadius.md,
181
- padding: theme.spacing.md,
182
- gap: theme.spacing.xs,
183
- },
184
- skeletonLine: {
185
- height: 16,
186
- borderRadius: theme.borderRadius.sm,
187
- backgroundColor: theme.dark ? theme.colors.secondary[600] : theme.colors.secondary[200],
188
- },
189
- skeletonTimestamp: {
190
- width: 60,
191
- height: 10,
192
- borderRadius: theme.borderRadius.sm,
193
- backgroundColor: theme.dark ? theme.colors.secondary[700] : theme.colors.secondary[300],
194
- marginLeft: isSent ? 0 : theme.spacing.xs,
195
- marginRight: isSent ? theme.spacing.xs : 0,
196
- },
197
- });
198
31
  // Skeleton loading component
199
32
  if (loading) {
200
- return (_jsxs(View, { style: [styles.skeletonContainer, style], children: [showAvatar && !isSent && _jsx(View, { style: styles.skeletonAvatar }), _jsxs(View, { style: styles.skeletonContent, children: [senderName && !isSent && _jsx(View, { style: styles.skeletonName }), _jsxs(View, { style: styles.skeletonMessage, children: [_jsx(View, { style: [styles.skeletonLine, { width: '100%' }] }), _jsx(View, { style: [styles.skeletonLine, { width: '85%' }] }), _jsx(View, { style: [styles.skeletonLine, { width: '70%' }] })] }), showTimestamp && _jsx(View, { style: styles.skeletonTimestamp })] }), showAvatar && isSent && _jsx(View, { style: styles.skeletonAvatar })] }));
33
+ return (_jsxs(View, { style: [
34
+ {
35
+ flexDirection: isSent ? 'row-reverse' : 'row',
36
+ alignItems: 'flex-start',
37
+ gap: theme.spacing.sm,
38
+ marginBottom: theme.spacing.sm,
39
+ maxWidth: `${maxWidth}%`,
40
+ alignSelf: isSent ? 'flex-end' : 'flex-start',
41
+ },
42
+ style,
43
+ ], children: [showAvatar && !isSent && _jsx(SSkeleton, { variant: "circular", width: 36, height: 36 }), _jsxs(View, { style: {
44
+ flex: 1,
45
+ gap: theme.spacing.xs,
46
+ }, children: [senderName && !isSent && (_jsx(SSkeleton, { variant: "text", width: 100, height: 12, style: { marginLeft: theme.spacing.xs } })), _jsxs(View, { style: {
47
+ width: 250,
48
+ maxWidth: '100%',
49
+ marginLeft: isSent ? 0 : theme.spacing.xs,
50
+ marginRight: isSent ? theme.spacing.xs : 0,
51
+ gap: theme.spacing.xs,
52
+ }, children: [_jsx(SSkeleton, { variant: "text", width: "100%", height: 16 }), _jsx(SSkeleton, { variant: "text", width: "85%", height: 16 }), _jsx(SSkeleton, { variant: "text", width: "70%", height: 16 })] }), showTimestamp && (_jsx(SSkeleton, { variant: "text", width: 60, height: 10, style: {
53
+ marginLeft: isSent ? 0 : theme.spacing.xs,
54
+ marginRight: isSent ? theme.spacing.xs : 0,
55
+ } }))] }), showAvatar && isSent && _jsx(SSkeleton, { variant: "circular", width: 36, height: 36 })] }));
201
56
  }
202
- return (_jsxs(View, { style: [styles.container, style], children: [showAvatar && !isSent && _jsx(SAvatar, { avatar: avatar, name: senderName, size: 36 }), _jsxs(View, { style: styles.contentColumn, children: [senderName && !isSent && _jsx(Text, { style: styles.senderName, children: senderName }), _jsxs(View, { style: [styles.messageBubble, messageBubbleStyle], children: [imageAttachments.length > 0 && (_jsx(View, { style: styles.imagesGrid, children: imageAttachments.map((attachment) => (_jsx(Pressable, { style: styles.imageContainer, onPress: () => handleImageClick(attachment), children: _jsx(SLazyImage, { src: attachment.thumbnailUrl || attachment.url, width: "100%", height: "100%", variant: "rounded", containerStyle: { width: '100%', height: '100%' } }) }, attachment.id))) })), fileAttachments.length > 0 && (_jsx(View, { style: styles.fileAttachmentsContainer, children: fileAttachments.map((attachment, index) => (_jsxs(Pressable, { style: [styles.fileAttachment, index > 0 && { marginTop: theme.spacing.sm }], onPress: () => handleFileClick(attachment), children: [_jsx(View, { style: styles.fileIcon, children: _jsx(Text, { style: styles.fileIconText, children: attachment.mimeType?.split('/')[1]?.slice(0, 3).toUpperCase() || 'FILE' }) }), _jsxs(View, { style: styles.fileInfo, children: [_jsx(Text, { style: styles.fileName, numberOfLines: 1, ellipsizeMode: "middle", children: attachment.name || 'Unnamed File' }), attachment.size && _jsx(Text, { style: styles.fileSize, children: formatFileSize(attachment.size) })] }), onDownload && (_jsx(IconButton, { icon: "download", size: 20, onPress: () => {
57
+ return (_jsxs(View, { style: [
58
+ {
59
+ flexDirection: isSent ? 'row-reverse' : 'row',
60
+ alignItems: 'flex-start',
61
+ gap: theme.spacing.sm,
62
+ marginBottom: theme.spacing.sm,
63
+ maxWidth: `${maxWidth}%`,
64
+ alignSelf: isSent ? 'flex-end' : 'flex-start',
65
+ },
66
+ style,
67
+ ], children: [showAvatar && !isSent && _jsx(SAvatar, { avatar: avatar, name: senderName, size: 36 }), _jsxs(View, { style: {
68
+ flexDirection: 'column',
69
+ alignItems: isSent ? 'flex-end' : 'flex-start',
70
+ gap: theme.spacing.xs,
71
+ minWidth: 0,
72
+ flex: 1,
73
+ }, children: [senderName && !isSent && _jsx(SText, { children: senderName }), _jsxs(View, { style: [
74
+ {
75
+ borderRadius: theme.borderRadius.md,
76
+ maxWidth: '100%',
77
+ borderWidth: 1,
78
+ borderColor: hasError ? theme.colors.error[500] : theme.colors.divider,
79
+ overflow: 'hidden',
80
+ opacity: hasError ? 0.7 : 1,
81
+ },
82
+ messageBubbleStyle,
83
+ ], children: [imageAttachments.length > 0 && (_jsx(View, { style: {
84
+ flexDirection: 'row',
85
+ flexWrap: 'wrap',
86
+ gap: theme.spacing.xs,
87
+ padding: theme.spacing.xs,
88
+ minWidth: 200,
89
+ }, children: imageAttachments.map((attachment) => (_jsx(Pressable, { style: {
90
+ borderRadius: theme.borderRadius.sm,
91
+ overflow: 'hidden',
92
+ width: imageAttachments.length === 1 ? '100%' : '48%',
93
+ aspectRatio: imageAttachments.length === 1 ? 1.5 : 1,
94
+ }, onPress: () => handleImageClick(attachment), children: _jsx(SLazyImage, { src: attachment.thumbnailUrl || attachment.url, width: "100%", height: "100%", variant: "rounded", containerStyle: { width: '100%', height: '100%' } }) }, attachment.id))) })), fileAttachments.length > 0 && (_jsx(View, { style: { padding: theme.spacing.md }, children: fileAttachments.map((attachment, index) => (_jsxs(Pressable, { style: [
95
+ {
96
+ flexDirection: 'row',
97
+ alignItems: 'center',
98
+ gap: theme.spacing.md,
99
+ padding: theme.spacing.sm,
100
+ borderWidth: 1,
101
+ borderColor: theme.colors.divider,
102
+ borderRadius: theme.borderRadius.md,
103
+ },
104
+ index > 0 && { marginTop: theme.spacing.sm },
105
+ ], onPress: () => handleFileClick(attachment), children: [_jsx(View, { style: {
106
+ width: 32,
107
+ height: 32,
108
+ backgroundColor: theme.colors.secondary[700],
109
+ borderRadius: theme.borderRadius.md,
110
+ justifyContent: 'center',
111
+ alignItems: 'center',
112
+ }, children: _jsx(SText, { variant: "caption", children: attachment.mimeType?.split('/')[1]?.slice(0, 3).toUpperCase() || 'FILE' }) }), _jsxs(View, { style: { flex: 1, minWidth: 0 }, children: [_jsx(SText, { numberOfLines: 1, ellipsizeMode: "middle", children: attachment.name || 'Unnamed File' }), attachment.size && _jsx(SText, { variant: "caption", children: formatFileSize(attachment.size) })] }), onDownload && (_jsx(SIconButton, { icon: "download", onPress: () => {
203
113
  onDownload(attachment);
204
- } }))] }, attachment.id))) })), message && (_jsx(View, { style: styles.messageContent, children: _jsx(Text, { style: [styles.messageText, messageTextStyle], children: message }) }))] }), showTimestamp && timestamp && _jsx(Text, { style: styles.timestampText, children: formatTimestamp(timestamp) }), hasError && (_jsxs(View, { style: styles.errorContainer, children: [_jsx(Text, { style: styles.errorText, children: errorMessage }), onRetry && _jsx(IconButton, { icon: "refresh", size: 16, iconColor: theme.colors.error.main, onPress: onRetry })] }))] }), showAvatar && isSent && _jsx(SAvatar, { avatar: avatar, name: senderName, size: 36 })] }));
114
+ } }))] }, attachment.id))) })), message && (_jsx(View, { style: {
115
+ paddingHorizontal: theme.spacing.md,
116
+ paddingVertical: theme.spacing.md,
117
+ paddingTop: attachments.length > 0 ? 0 : theme.spacing.md,
118
+ }, children: _jsx(SText, { style: [
119
+ {
120
+ color: hasError ? theme.colors.error[500] : theme.colors.text.primary,
121
+ },
122
+ messageTextStyle,
123
+ ], children: message }) }))] }), showTimestamp && timestamp && _jsx(SText, { variant: "caption", children: formatTimestamp(timestamp) }), hasError && (_jsxs(View, { style: {
124
+ flexDirection: 'row',
125
+ alignItems: 'center',
126
+ gap: theme.spacing.xs,
127
+ }, children: [_jsx(SText, { style: {
128
+ color: theme.colors.error[500],
129
+ }, variant: "caption", children: errorMessage }), onRetry && (_jsx(SIconButton, { icon: "refresh", size: "medium", iconColor: theme.colors.error[500], onPress: onRetry }))] }))] }), showAvatar && isSent && _jsx(SAvatar, { avatar: avatar, name: senderName, size: 36 })] }));
205
130
  };
206
131
  SChatMessage.displayName = 'SChatMessage';
207
132
  export default SChatMessage;
@@ -3,7 +3,6 @@ import { type StyleProp, type ViewStyle } from 'react-native';
3
3
  import { type CheckboxProps } from 'react-native-paper';
4
4
  /**
5
5
  * Props interface for SCheckbox component
6
- * Synced with web SCheckbox from @solostylist/ui-kit
7
6
  */
8
7
  export interface SCheckboxProps extends Omit<CheckboxProps, 'theme' | 'status'> {
9
8
  /** Content displayed as a clickable label next to the checkbox */
@@ -24,7 +23,6 @@ export interface SCheckboxProps extends Omit<CheckboxProps, 'theme' | 'status'>
24
23
  /**
25
24
  * A checkbox component with integrated label support and proper accessibility.
26
25
  * Built on React Native Paper Checkbox with consistent theming.
27
- * Synced with web SCheckbox from @solostylist/ui-kit.
28
26
  */
29
27
  export declare const SCheckbox: {
30
28
  ({ content, checked, indeterminate, disabled, onPress, style, labelStyle, ...props }: SCheckboxProps): React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"s-checkbox.d.ts","sourceRoot":"","sources":["../../src/s-checkbox/s-checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIlE;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC7E,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACnC,sCAAsC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gEAAgE;IAChE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;I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"react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
- import { StyleSheet } from 'react-native';
3
+ import { Pressable } from 'react-native';
4
4
  import { Checkbox } from 'react-native-paper';
5
5
  import { SText } from '../s-text';
6
6
  import { useSTheme } from '../theme';
7
7
  /**
8
8
  * A checkbox component with integrated label support and proper accessibility.
9
9
  * Built on React Native Paper Checkbox with consistent theming.
10
- * Synced with web SCheckbox from @solostylist/ui-kit.
11
10
  */
12
11
  export const SCheckbox = ({ content, checked = false, indeterminate = false, disabled = false, onPress, style, labelStyle, ...props }) => {
13
12
  const { theme } = useSTheme();
@@ -31,21 +30,6 @@ export const SCheckbox = ({ content, checked = false, indeterminate = false, dis
31
30
  labelColor,
32
31
  };
33
32
  }, [theme.dark, theme.colors, checked, indeterminate, disabled]);
34
- const styles = useMemo(() => StyleSheet.create({
35
- container: {
36
- flexDirection: 'row',
37
- alignItems: 'center',
38
- justifyContent: 'flex-start',
39
- },
40
- checkbox: {
41
- marginRight: content ? -8 : 0, // Adjust spacing when there's a label
42
- },
43
- label: {
44
- flex: 1,
45
- marginLeft: theme.spacing.xs,
46
- opacity: disabled ? 0.6 : 1,
47
- },
48
- }), [theme.spacing.xs, content, disabled]);
49
33
  const handlePress = () => {
50
34
  if (!disabled && onPress) {
51
35
  onPress();
@@ -53,7 +37,16 @@ export const SCheckbox = ({ content, checked = false, indeterminate = false, dis
53
37
  };
54
38
  // Determine checkbox status
55
39
  const status = indeterminate ? 'indeterminate' : checked ? 'checked' : 'unchecked';
56
- return (_jsxs(SText, { variant: "body2", style: [styles.container, style], onPress: handlePress, suppressHighlighting: true, disabled: disabled, children: [_jsx(Checkbox.Android, { status: status, disabled: disabled, onPress: handlePress, color: colors.checkboxColor, uncheckedColor: colors.checkboxColor, style: styles.checkbox, ...props }), content && (_jsx(SText, { variant: "body2", style: [styles.label, { color: colors.labelColor }, labelStyle], children: content }))] }));
40
+ return (_jsxs(Pressable, { style: [
41
+ {
42
+ flexDirection: 'row',
43
+ alignItems: 'center',
44
+ justifyContent: 'flex-start',
45
+ },
46
+ style,
47
+ ], onPress: handlePress, disabled: disabled, children: [_jsx(Checkbox.Android, { status: status, disabled: disabled, onPress: handlePress, color: colors.checkboxColor, uncheckedColor: colors.checkboxColor, style: {
48
+ marginRight: content ? -8 : 0, // Adjust spacing when there's a label
49
+ }, ...props }), content && (_jsx(SText, { variant: "body2", style: [{ color: colors.labelColor }, labelStyle], children: content }))] }));
57
50
  };
58
51
  SCheckbox.displayName = 'SCheckbox';
59
52
  export default SCheckbox;
@@ -15,7 +15,6 @@ export type SChipVariant = 'filled' | 'outlined';
15
15
  export type SChipSize = 'small' | 'medium';
16
16
  /**
17
17
  * Props interface for SChip component
18
- * Synced with web SChip from @solostylist/ui-kit
19
18
  */
20
19
  export interface SChipProps extends Omit<ChipProps, 'theme' | 'mode' | 'children' | 'icon' | 'avatar'> {
21
20
  /** Label text to display in the chip */
@@ -44,7 +43,6 @@ export interface SChipProps extends Omit<ChipProps, 'theme' | 'mode' | 'children
44
43
  /**
45
44
  * A versatile chip component for displaying compact elements like tags, filters, or selections.
46
45
  * Built on React Native Paper Chip with consistent theming.
47
- * Synced with web SChip from @solostylist/ui-kit.
48
46
  */
49
47
  export declare const SChip: {
50
48
  ({ label, variant, color, size, disabled, icon, avatar, selected, onPress, onClose, style, textStyle, ...props }: SChipProps): React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"s-chip.d.ts","sourceRoot":"","sources":["../../src/s-chip/s-chip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAoB1D;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC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