@solostylist/ui-kit-native 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/use-count-down.d.ts +74 -0
- package/dist/hooks/use-count-down.d.ts.map +1 -0
- package/dist/hooks/use-count-down.js +204 -0
- package/dist/hooks/use-is-passed-position.d.ts +20 -0
- package/dist/hooks/use-is-passed-position.d.ts.map +1 -0
- package/dist/hooks/use-is-passed-position.js +31 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -0
- package/dist/s-avatar/index.d.ts +3 -0
- package/dist/s-avatar/index.d.ts.map +1 -0
- package/dist/s-avatar/index.js +1 -0
- package/dist/s-avatar/s-avatar.d.ts +47 -0
- package/dist/s-avatar/s-avatar.d.ts.map +1 -0
- package/dist/s-avatar/s-avatar.js +112 -0
- package/dist/s-button/index.d.ts +3 -0
- package/dist/s-button/index.d.ts.map +1 -0
- package/dist/s-button/index.js +1 -0
- package/dist/s-button/s-button.d.ts +57 -0
- package/dist/s-button/s-button.d.ts.map +1 -0
- package/dist/s-button/s-button.js +158 -0
- package/dist/s-button-link/index.d.ts +2 -0
- package/dist/s-button-link/index.d.ts.map +1 -0
- package/dist/s-button-link/index.js +1 -0
- package/dist/s-button-link/s-button-link.d.ts +45 -0
- package/dist/s-button-link/s-button-link.d.ts.map +1 -0
- package/dist/s-button-link/s-button-link.js +64 -0
- package/dist/s-chat-input/index.d.ts +2 -0
- package/dist/s-chat-input/index.d.ts.map +1 -0
- package/dist/s-chat-input/index.js +1 -0
- package/dist/s-chat-input/s-chat-input.d.ts +41 -0
- package/dist/s-chat-input/s-chat-input.d.ts.map +1 -0
- package/dist/s-chat-input/s-chat-input.js +66 -0
- package/dist/s-chat-message/index.d.ts +3 -0
- package/dist/s-chat-message/index.d.ts.map +1 -0
- package/dist/s-chat-message/index.js +2 -0
- package/dist/s-chat-message/s-chat-message.d.ts +63 -0
- package/dist/s-chat-message/s-chat-message.d.ts.map +1 -0
- package/dist/s-chat-message/s-chat-message.js +207 -0
- package/dist/s-checkbox/index.d.ts +3 -0
- package/dist/s-checkbox/index.d.ts.map +1 -0
- package/dist/s-checkbox/index.js +1 -0
- package/dist/s-checkbox/s-checkbox.d.ts +34 -0
- package/dist/s-checkbox/s-checkbox.d.ts.map +1 -0
- package/dist/s-checkbox/s-checkbox.js +59 -0
- package/dist/s-chip/index.d.ts +3 -0
- package/dist/s-chip/index.d.ts.map +1 -0
- package/dist/s-chip/index.js +1 -0
- package/dist/s-chip/s-chip.d.ts +54 -0
- package/dist/s-chip/s-chip.d.ts.map +1 -0
- package/dist/s-chip/s-chip.js +170 -0
- package/dist/s-code-block/index.d.ts +3 -0
- package/dist/s-code-block/index.d.ts.map +1 -0
- package/dist/s-code-block/index.js +2 -0
- package/dist/s-code-block/s-code-block.d.ts +42 -0
- package/dist/s-code-block/s-code-block.d.ts.map +1 -0
- package/dist/s-code-block/s-code-block.js +81 -0
- package/dist/s-comment-message/index.d.ts +3 -0
- package/dist/s-comment-message/index.d.ts.map +1 -0
- package/dist/s-comment-message/index.js +2 -0
- package/dist/s-comment-message/s-comment-message.d.ts +56 -0
- package/dist/s-comment-message/s-comment-message.d.ts.map +1 -0
- package/dist/s-comment-message/s-comment-message.js +222 -0
- package/dist/s-copyable-text/index.d.ts +3 -0
- package/dist/s-copyable-text/index.d.ts.map +1 -0
- package/dist/s-copyable-text/index.js +1 -0
- package/dist/s-copyable-text/s-copyable-text.d.ts +26 -0
- package/dist/s-copyable-text/s-copyable-text.d.ts.map +1 -0
- package/dist/s-copyable-text/s-copyable-text.js +77 -0
- package/dist/s-countdown/index.d.ts +8 -0
- package/dist/s-countdown/index.d.ts.map +1 -0
- package/dist/s-countdown/index.js +7 -0
- package/dist/s-countdown/s-count-box.d.ts +42 -0
- package/dist/s-countdown/s-count-box.d.ts.map +1 -0
- package/dist/s-countdown/s-count-box.js +126 -0
- package/dist/s-countdown/s-countdown.d.ts +69 -0
- package/dist/s-countdown/s-countdown.d.ts.map +1 -0
- package/dist/s-countdown/s-countdown.js +93 -0
- package/dist/s-data-table/index.d.ts +3 -0
- package/dist/s-data-table/index.d.ts.map +1 -0
- package/dist/s-data-table/index.js +2 -0
- package/dist/s-data-table/s-data-table.d.ts +67 -0
- package/dist/s-data-table/s-data-table.d.ts.map +1 -0
- package/dist/s-data-table/s-data-table.js +98 -0
- package/dist/s-date-picker/index.d.ts +3 -0
- package/dist/s-date-picker/index.d.ts.map +1 -0
- package/dist/s-date-picker/index.js +2 -0
- package/dist/s-date-picker/s-date-picker.d.ts +43 -0
- package/dist/s-date-picker/s-date-picker.d.ts.map +1 -0
- package/dist/s-date-picker/s-date-picker.js +220 -0
- package/dist/s-date-time-picker/index.d.ts +3 -0
- package/dist/s-date-time-picker/index.d.ts.map +1 -0
- package/dist/s-date-time-picker/index.js +2 -0
- package/dist/s-date-time-picker/s-date-time-picker.d.ts +49 -0
- package/dist/s-date-time-picker/s-date-time-picker.d.ts.map +1 -0
- package/dist/s-date-time-picker/s-date-time-picker.js +390 -0
- package/dist/s-file-dropzone/index.d.ts +3 -0
- package/dist/s-file-dropzone/index.d.ts.map +1 -0
- package/dist/s-file-dropzone/index.js +2 -0
- package/dist/s-file-dropzone/s-file-dropzone.d.ts +98 -0
- package/dist/s-file-dropzone/s-file-dropzone.d.ts.map +1 -0
- package/dist/s-file-dropzone/s-file-dropzone.js +189 -0
- package/dist/s-file-icon/index.d.ts +3 -0
- package/dist/s-file-icon/index.d.ts.map +1 -0
- package/dist/s-file-icon/index.js +2 -0
- package/dist/s-file-icon/s-file-icon.d.ts +25 -0
- package/dist/s-file-icon/s-file-icon.d.ts.map +1 -0
- package/dist/s-file-icon/s-file-icon.js +87 -0
- package/dist/s-image-comparison/index.d.ts +2 -0
- package/dist/s-image-comparison/index.d.ts.map +1 -0
- package/dist/s-image-comparison/index.js +1 -0
- package/dist/s-image-comparison/s-image-comparison.d.ts +37 -0
- package/dist/s-image-comparison/s-image-comparison.d.ts.map +1 -0
- package/dist/s-image-comparison/s-image-comparison.js +138 -0
- package/dist/s-label/index.d.ts +3 -0
- package/dist/s-label/index.d.ts.map +1 -0
- package/dist/s-label/index.js +1 -0
- package/dist/s-label/s-label.d.ts +25 -0
- package/dist/s-label/s-label.d.ts.map +1 -0
- package/dist/s-label/s-label.js +35 -0
- package/dist/s-language-switcher/index.d.ts +4 -0
- package/dist/s-language-switcher/index.d.ts.map +1 -0
- package/dist/s-language-switcher/index.js +2 -0
- package/dist/s-language-switcher/s-language-switcher.d.ts +56 -0
- package/dist/s-language-switcher/s-language-switcher.d.ts.map +1 -0
- package/dist/s-language-switcher/s-language-switcher.js +68 -0
- package/dist/s-lazy-image/index.d.ts +3 -0
- package/dist/s-lazy-image/index.d.ts.map +1 -0
- package/dist/s-lazy-image/index.js +1 -0
- package/dist/s-lazy-image/s-lazy-image.d.ts +45 -0
- package/dist/s-lazy-image/s-lazy-image.d.ts.map +1 -0
- package/dist/s-lazy-image/s-lazy-image.js +71 -0
- package/dist/s-moving-border/index.d.ts +2 -0
- package/dist/s-moving-border/index.d.ts.map +1 -0
- package/dist/s-moving-border/index.js +1 -0
- package/dist/s-moving-border/s-moving-border.d.ts +40 -0
- package/dist/s-moving-border/s-moving-border.d.ts.map +1 -0
- package/dist/s-moving-border/s-moving-border.js +158 -0
- package/dist/s-multi-select/index.d.ts +2 -0
- package/dist/s-multi-select/index.d.ts.map +1 -0
- package/dist/s-multi-select/index.js +1 -0
- package/dist/s-multi-select/s-multi-select.d.ts +55 -0
- package/dist/s-multi-select/s-multi-select.d.ts.map +1 -0
- package/dist/s-multi-select/s-multi-select.js +201 -0
- package/dist/s-pagination/index.d.ts +3 -0
- package/dist/s-pagination/index.d.ts.map +1 -0
- package/dist/s-pagination/index.js +2 -0
- package/dist/s-pagination/s-pagination.d.ts +43 -0
- package/dist/s-pagination/s-pagination.d.ts.map +1 -0
- package/dist/s-pagination/s-pagination.js +121 -0
- package/dist/s-rating/index.d.ts +3 -0
- package/dist/s-rating/index.d.ts.map +1 -0
- package/dist/s-rating/index.js +1 -0
- package/dist/s-rating/s-rating.d.ts +57 -0
- package/dist/s-rating/s-rating.d.ts.map +1 -0
- package/dist/s-rating/s-rating.js +155 -0
- package/dist/s-review/index.d.ts +3 -0
- package/dist/s-review/index.d.ts.map +1 -0
- package/dist/s-review/index.js +1 -0
- package/dist/s-review/s-review.d.ts +57 -0
- package/dist/s-review/s-review.d.ts.map +1 -0
- package/dist/s-review/s-review.js +235 -0
- package/dist/s-scroll-to-top/index.d.ts +3 -0
- package/dist/s-scroll-to-top/index.d.ts.map +1 -0
- package/dist/s-scroll-to-top/index.js +2 -0
- package/dist/s-scroll-to-top/s-scroll-to-top.d.ts +38 -0
- package/dist/s-scroll-to-top/s-scroll-to-top.d.ts.map +1 -0
- package/dist/s-scroll-to-top/s-scroll-to-top.js +76 -0
- package/dist/s-select/s-select.d.ts.map +1 -1
- package/dist/s-select/s-select.js +8 -8
- package/dist/s-select-list/index.d.ts +3 -0
- package/dist/s-select-list/index.d.ts.map +1 -0
- package/dist/s-select-list/index.js +2 -0
- package/dist/s-select-list/s-select-list.d.ts +36 -0
- package/dist/s-select-list/s-select-list.d.ts.map +1 -0
- package/dist/s-select-list/s-select-list.js +129 -0
- package/dist/s-text-shimmer/index.d.ts +2 -0
- package/dist/s-text-shimmer/index.d.ts.map +1 -0
- package/dist/s-text-shimmer/index.js +1 -0
- package/dist/s-text-shimmer/s-text-shimmer.d.ts +36 -0
- package/dist/s-text-shimmer/s-text-shimmer.d.ts.map +1 -0
- package/dist/s-text-shimmer/s-text-shimmer.js +120 -0
- package/dist/s-text-truncation/index.d.ts +2 -0
- package/dist/s-text-truncation/index.d.ts.map +1 -0
- package/dist/s-text-truncation/index.js +1 -0
- package/dist/s-text-truncation/s-text-truncation.d.ts +45 -0
- package/dist/s-text-truncation/s-text-truncation.d.ts.map +1 -0
- package/dist/s-text-truncation/s-text-truncation.js +48 -0
- package/dist/s-tip/index.d.ts +3 -0
- package/dist/s-tip/index.d.ts.map +1 -0
- package/dist/s-tip/index.js +1 -0
- package/dist/s-tip/s-tip.d.ts +18 -0
- package/dist/s-tip/s-tip.d.ts.map +1 -0
- package/dist/s-tip/s-tip.js +32 -0
- package/dist/s-zoom-image/index.d.ts +3 -0
- package/dist/s-zoom-image/index.d.ts.map +1 -0
- package/dist/s-zoom-image/index.js +1 -0
- package/dist/s-zoom-image/s-zoom-image.d.ts +40 -0
- package/dist/s-zoom-image/s-zoom-image.d.ts.map +1 -0
- package/dist/s-zoom-image/s-zoom-image.js +154 -0
- package/dist/utils/bytes-to-size.d.ts +10 -0
- package/dist/utils/bytes-to-size.d.ts.map +1 -0
- package/dist/utils/bytes-to-size.js +18 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +174 -5
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
|
|
3
|
+
import { type ButtonProps } from 'react-native-paper';
|
|
4
|
+
/**
|
|
5
|
+
* Button color variants - matches web SButton from @solostylist/ui-kit
|
|
6
|
+
*/
|
|
7
|
+
export type SButtonColor = 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
|
|
8
|
+
/**
|
|
9
|
+
* Button visual variants - matches web SButton from @solostylist/ui-kit
|
|
10
|
+
*/
|
|
11
|
+
export type SButtonVariant = 'text' | 'outlined' | 'contained';
|
|
12
|
+
/**
|
|
13
|
+
* Button size variants - matches web SButton from @solostylist/ui-kit
|
|
14
|
+
*/
|
|
15
|
+
export type SButtonSize = 'small' | 'medium' | 'large';
|
|
16
|
+
/**
|
|
17
|
+
* Props interface for SButton component
|
|
18
|
+
* Synced with web SButton from @solostylist/ui-kit
|
|
19
|
+
*/
|
|
20
|
+
export interface SButtonProps extends Omit<ButtonProps, 'theme' | 'mode' | 'buttonColor' | 'textColor' | 'children'> {
|
|
21
|
+
/** Visual variant of the button */
|
|
22
|
+
variant?: SButtonVariant;
|
|
23
|
+
/** Theme color of the button */
|
|
24
|
+
color?: SButtonColor;
|
|
25
|
+
/** Size of the button */
|
|
26
|
+
size?: SButtonSize;
|
|
27
|
+
/** Whether the button is in loading state */
|
|
28
|
+
loading?: boolean;
|
|
29
|
+
/** Whether the button takes full width */
|
|
30
|
+
fullWidth?: boolean;
|
|
31
|
+
/** Whether the button is disabled */
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
/** Icon to display at the start of the button */
|
|
34
|
+
startIcon?: React.ReactNode;
|
|
35
|
+
/** Icon to display at the end of the button */
|
|
36
|
+
endIcon?: React.ReactNode;
|
|
37
|
+
/** Button text content */
|
|
38
|
+
children?: React.ReactNode;
|
|
39
|
+
/** Additional styles for the button container */
|
|
40
|
+
style?: StyleProp<ViewStyle>;
|
|
41
|
+
/** Additional styles for the button label */
|
|
42
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
43
|
+
/** Additional styles for the button content */
|
|
44
|
+
contentStyle?: StyleProp<ViewStyle>;
|
|
45
|
+
/** Callback fired when button is pressed */
|
|
46
|
+
onPress?: () => void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A versatile button component built on React Native Paper Button with consistent theming.
|
|
50
|
+
* Synced with web SButton from @solostylist/ui-kit.
|
|
51
|
+
*/
|
|
52
|
+
export declare const SButton: {
|
|
53
|
+
({ variant, color, size, loading, fullWidth, disabled, startIcon, endIcon, children, style, labelStyle, contentStyle, onPress, icon, ...props }: SButtonProps): React.JSX.Element;
|
|
54
|
+
displayName: string;
|
|
55
|
+
};
|
|
56
|
+
export default SButton;
|
|
57
|
+
//# sourceMappingURL=s-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s-button.d.ts","sourceRoot":"","sources":["../../src/s-button/s-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAkBjF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAE9F;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;IAClH,mCAAmC;IACnC,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,gCAAgC;IAChC,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,yBAAyB;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iDAAiD;IACjD,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,+CAA+C;IAC/C,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,iDAAiD;IACjD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,6CAA6C;IAC7C,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,+CAA+C;IAC/C,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAwED;;;GAGG;AACH,eAAO,MAAM,OAAO;qJAgBjB,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO;;CA+GlC,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
import { ActivityIndicator, Button } from 'react-native-paper';
|
|
5
|
+
import { blue, brand, green, lightBlue, lightBrand, lightGreen, lightOrange, lightPurple, lightRed, orange, purple, red, } from '@solostylist/core';
|
|
6
|
+
import { useSTheme } from '../theme';
|
|
7
|
+
/**
|
|
8
|
+
* Get color palettes for light and dark modes
|
|
9
|
+
*/
|
|
10
|
+
const getColorPalettes = (color) => {
|
|
11
|
+
switch (color) {
|
|
12
|
+
case 'primary':
|
|
13
|
+
return { light: lightBrand, dark: brand };
|
|
14
|
+
case 'secondary':
|
|
15
|
+
return { light: lightPurple, dark: purple };
|
|
16
|
+
case 'success':
|
|
17
|
+
return { light: lightGreen, dark: green };
|
|
18
|
+
case 'error':
|
|
19
|
+
return { light: lightRed, dark: red };
|
|
20
|
+
case 'info':
|
|
21
|
+
return { light: lightBlue, dark: blue };
|
|
22
|
+
case 'warning':
|
|
23
|
+
return { light: lightOrange, dark: orange };
|
|
24
|
+
default:
|
|
25
|
+
return { light: lightBrand, dark: brand };
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Map variant to react-native-paper mode
|
|
30
|
+
*/
|
|
31
|
+
const variantToMode = (variant) => {
|
|
32
|
+
switch (variant) {
|
|
33
|
+
case 'text':
|
|
34
|
+
return 'text';
|
|
35
|
+
case 'outlined':
|
|
36
|
+
return 'outlined';
|
|
37
|
+
case 'contained':
|
|
38
|
+
return 'contained';
|
|
39
|
+
default:
|
|
40
|
+
return 'contained';
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Get button height based on size - matches web MUI sizes
|
|
45
|
+
*/
|
|
46
|
+
const getSizeHeight = (size) => {
|
|
47
|
+
switch (size) {
|
|
48
|
+
case 'small':
|
|
49
|
+
return 36; // 2.25rem
|
|
50
|
+
case 'medium':
|
|
51
|
+
return 40; // 2.5rem
|
|
52
|
+
case 'large':
|
|
53
|
+
return 44; // 2.75rem
|
|
54
|
+
default:
|
|
55
|
+
return 40;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Get font size based on button size
|
|
60
|
+
*/
|
|
61
|
+
const getFontSize = (size) => {
|
|
62
|
+
switch (size) {
|
|
63
|
+
case 'small':
|
|
64
|
+
return 13;
|
|
65
|
+
case 'medium':
|
|
66
|
+
return 14;
|
|
67
|
+
case 'large':
|
|
68
|
+
return 15;
|
|
69
|
+
default:
|
|
70
|
+
return 14;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* A versatile button component built on React Native Paper Button with consistent theming.
|
|
75
|
+
* Synced with web SButton from @solostylist/ui-kit.
|
|
76
|
+
*/
|
|
77
|
+
export const SButton = ({ variant = 'contained', color = 'primary', size = 'medium', loading = false, fullWidth = false, disabled = false, startIcon, endIcon, children, style, labelStyle, contentStyle, onPress, icon, ...props }) => {
|
|
78
|
+
const { theme } = useSTheme();
|
|
79
|
+
const { light: lightColor, dark: darkColor } = getColorPalettes(color);
|
|
80
|
+
const colorPalette = theme.dark ? darkColor : lightColor;
|
|
81
|
+
// Calculate colors based on variant and theme mode
|
|
82
|
+
const colors = useMemo(() => {
|
|
83
|
+
const isDark = theme.dark;
|
|
84
|
+
// Background color
|
|
85
|
+
let backgroundColor;
|
|
86
|
+
if (variant === 'text' || variant === 'outlined') {
|
|
87
|
+
backgroundColor = 'transparent';
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
backgroundColor = isDark ? colorPalette[800] : colorPalette[700];
|
|
91
|
+
}
|
|
92
|
+
// Text color
|
|
93
|
+
let textColor;
|
|
94
|
+
if (variant === 'text' || variant === 'outlined') {
|
|
95
|
+
textColor = colorPalette[500];
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
textColor = isDark ? colorPalette[100] : colorPalette[50];
|
|
99
|
+
}
|
|
100
|
+
// Border color (for outlined variant)
|
|
101
|
+
let borderColor;
|
|
102
|
+
if (variant === 'outlined') {
|
|
103
|
+
borderColor = isDark ? colorPalette[800] : colorPalette[300];
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
borderColor = 'transparent';
|
|
107
|
+
}
|
|
108
|
+
// Disabled state
|
|
109
|
+
if (disabled) {
|
|
110
|
+
return {
|
|
111
|
+
backgroundColor: variant === 'contained' ? backgroundColor : 'transparent',
|
|
112
|
+
textColor: textColor,
|
|
113
|
+
borderColor: variant === 'outlined' ? (isDark ? colorPalette[900] : colorPalette[900]) : 'transparent',
|
|
114
|
+
opacity: 0.5,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
backgroundColor,
|
|
119
|
+
textColor,
|
|
120
|
+
borderColor,
|
|
121
|
+
opacity: 1,
|
|
122
|
+
};
|
|
123
|
+
}, [theme.dark, variant, colorPalette, disabled]);
|
|
124
|
+
const height = getSizeHeight(size);
|
|
125
|
+
const fontSize = getFontSize(size);
|
|
126
|
+
const styles = useMemo(() => StyleSheet.create({
|
|
127
|
+
button: {
|
|
128
|
+
borderRadius: theme.borderRadius.md, // 8px to match web
|
|
129
|
+
opacity: colors.opacity,
|
|
130
|
+
...(fullWidth ? { width: '100%' } : {}),
|
|
131
|
+
},
|
|
132
|
+
content: {
|
|
133
|
+
height,
|
|
134
|
+
flexDirection: 'row',
|
|
135
|
+
alignItems: 'center',
|
|
136
|
+
justifyContent: 'center',
|
|
137
|
+
},
|
|
138
|
+
label: {
|
|
139
|
+
fontFamily: theme.typography.fontFamily,
|
|
140
|
+
fontSize,
|
|
141
|
+
fontWeight: '500',
|
|
142
|
+
textTransform: 'none',
|
|
143
|
+
letterSpacing: 0,
|
|
144
|
+
marginVertical: 0,
|
|
145
|
+
},
|
|
146
|
+
}), [theme.borderRadius.md, theme.typography.fontFamily, colors.opacity, fullWidth, height, fontSize]);
|
|
147
|
+
// Determine icon to use (startIcon takes precedence, then icon prop)
|
|
148
|
+
const buttonIcon = startIcon
|
|
149
|
+
? () => (_jsx(React.Fragment, { children: loading ? _jsx(ActivityIndicator, { size: fontSize, color: colors.textColor }) : startIcon }))
|
|
150
|
+
: icon
|
|
151
|
+
? icon
|
|
152
|
+
: loading
|
|
153
|
+
? () => _jsx(ActivityIndicator, { size: fontSize, color: colors.textColor })
|
|
154
|
+
: undefined;
|
|
155
|
+
return (_jsxs(Button, { mode: variantToMode(variant), disabled: disabled || loading, onPress: onPress, icon: buttonIcon, buttonColor: colors.backgroundColor, textColor: colors.textColor, style: [styles.button, variant === 'outlined' && { borderColor: colors.borderColor, borderWidth: 1 }, style], contentStyle: [styles.content, contentStyle], labelStyle: [styles.label, labelStyle], ...props, children: [children, endIcon && !loading && endIcon] }));
|
|
156
|
+
};
|
|
157
|
+
SButton.displayName = 'SButton';
|
|
158
|
+
export default SButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/s-button-link/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SButtonLink, default } from './s-button-link';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type StyleProp, type TextStyle } from 'react-native';
|
|
3
|
+
import { type STextProps } from '../s-text';
|
|
4
|
+
/**
|
|
5
|
+
* Props interface for SButtonLink component
|
|
6
|
+
* Synced with web SButtonLink from @solostylist/ui-kit
|
|
7
|
+
*/
|
|
8
|
+
export interface SButtonLinkProps {
|
|
9
|
+
/** Text or element displayed before the main link */
|
|
10
|
+
beforeText?: string | React.ReactNode;
|
|
11
|
+
/** Text or element displayed after the main link */
|
|
12
|
+
afterText?: string | React.ReactNode;
|
|
13
|
+
/** The main clickable link text or element */
|
|
14
|
+
mainText?: string | React.ReactNode;
|
|
15
|
+
/** URL for the link (for external navigation using Linking API) */
|
|
16
|
+
href?: string;
|
|
17
|
+
/** Target behavior - 'blank' for external links (opens in browser) */
|
|
18
|
+
target?: '_blank' | '_self';
|
|
19
|
+
/** Color of the surrounding text */
|
|
20
|
+
color?: string;
|
|
21
|
+
/** Color of the link itself (overrides default link color) */
|
|
22
|
+
linkColor?: string;
|
|
23
|
+
/** Line height for the typography */
|
|
24
|
+
lineHeight?: number;
|
|
25
|
+
/** Typography variant for the container text - matches web SButtonLink */
|
|
26
|
+
variant?: STextProps['variant'];
|
|
27
|
+
/** Press handler for the link */
|
|
28
|
+
onPress?: () => void;
|
|
29
|
+
/** Additional styles for the container */
|
|
30
|
+
style?: StyleProp<TextStyle>;
|
|
31
|
+
/** Additional styles for the link text */
|
|
32
|
+
linkStyle?: StyleProp<TextStyle>;
|
|
33
|
+
/** Whether the link is disabled */
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A flexible link component that combines text and a clickable link element.
|
|
38
|
+
* Synced with web SButtonLink from @solostylist/ui-kit for cross-platform consistency.
|
|
39
|
+
*/
|
|
40
|
+
export declare const SButtonLink: {
|
|
41
|
+
({ beforeText, afterText, mainText, href, target, color, linkColor, variant, lineHeight, onPress, style, linkStyle, disabled, }: SButtonLinkProps): React.JSX.Element;
|
|
42
|
+
displayName: string;
|
|
43
|
+
};
|
|
44
|
+
export default SButtonLink;
|
|
45
|
+
//# sourceMappingURL=s-button-link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s-button-link.d.ts","sourceRoot":"","sources":["../../src/s-button-link/s-button-link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAwC,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAGnD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACtC,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACrC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACpC,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC5B,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAChC,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW;qIAcrB,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO;;CAqGtC,CAAC;AAIF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Linking, Pressable, StyleSheet, View } from 'react-native';
|
|
3
|
+
import { SText } from '../s-text';
|
|
4
|
+
import { useSTheme } from '../theme';
|
|
5
|
+
/**
|
|
6
|
+
* A flexible link component that combines text and a clickable link element.
|
|
7
|
+
* Synced with web SButtonLink from @solostylist/ui-kit for cross-platform consistency.
|
|
8
|
+
*/
|
|
9
|
+
export const SButtonLink = ({ beforeText = '', afterText = '', mainText = '', href, target, color, linkColor, variant = 'body2', lineHeight, onPress, style, linkStyle, disabled = false, }) => {
|
|
10
|
+
const { theme } = useSTheme();
|
|
11
|
+
// Determine text color - matches web default
|
|
12
|
+
const textColor = color || theme.colors.text.secondary;
|
|
13
|
+
// Determine link color - matches web default (primary color)
|
|
14
|
+
const activeLinkColor = linkColor || theme.colors.primary[500];
|
|
15
|
+
const handlePress = () => {
|
|
16
|
+
if (disabled)
|
|
17
|
+
return;
|
|
18
|
+
if (onPress) {
|
|
19
|
+
onPress();
|
|
20
|
+
}
|
|
21
|
+
else if (href) {
|
|
22
|
+
// If target is _blank or not specified for http/https URLs, open in browser
|
|
23
|
+
if (target === '_blank' || href.startsWith('http://') || href.startsWith('https://')) {
|
|
24
|
+
Linking.openURL(href).catch((err) => console.error('Failed to open URL:', err));
|
|
25
|
+
}
|
|
26
|
+
// For internal navigation, onPress should be provided
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const styles = StyleSheet.create({
|
|
30
|
+
container: {
|
|
31
|
+
flexDirection: 'row',
|
|
32
|
+
flexWrap: 'wrap',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
},
|
|
35
|
+
link: {
|
|
36
|
+
textDecorationLine: 'underline',
|
|
37
|
+
textDecorationStyle: 'solid',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
return (_jsxs(View, { style: styles.container, children: [beforeText && (_jsxs(_Fragment, { children: [_jsx(SText, { variant: variant, style: [
|
|
41
|
+
{
|
|
42
|
+
color: textColor,
|
|
43
|
+
lineHeight,
|
|
44
|
+
},
|
|
45
|
+
style,
|
|
46
|
+
], children: beforeText }), _jsx(SText, { variant: variant, style: { color: textColor }, children: ' ' })] })), _jsx(Pressable, { onPress: handlePress, disabled: disabled, children: ({ pressed }) => (_jsx(SText, { variant: variant, style: [
|
|
47
|
+
styles.link,
|
|
48
|
+
{
|
|
49
|
+
color: activeLinkColor,
|
|
50
|
+
lineHeight,
|
|
51
|
+
opacity: disabled ? 0.5 : pressed ? 0.7 : 1,
|
|
52
|
+
},
|
|
53
|
+
style,
|
|
54
|
+
linkStyle,
|
|
55
|
+
], children: mainText })) }), afterText && (_jsxs(_Fragment, { children: [_jsx(SText, { variant: variant, style: { color: textColor }, children: ' ' }), _jsx(SText, { variant: variant, style: [
|
|
56
|
+
{
|
|
57
|
+
color: textColor,
|
|
58
|
+
lineHeight,
|
|
59
|
+
},
|
|
60
|
+
style,
|
|
61
|
+
], children: afterText })] }))] }));
|
|
62
|
+
};
|
|
63
|
+
SButtonLink.displayName = 'SButtonLink';
|
|
64
|
+
export default SButtonLink;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/s-chat-input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SChatInput, default } from './s-chat-input';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props interface for SChatInput component
|
|
4
|
+
* Synced with web SChatInput from @solostylist/ui-kit
|
|
5
|
+
*/
|
|
6
|
+
export interface SChatInputProps {
|
|
7
|
+
/** Current value of the input */
|
|
8
|
+
value?: string;
|
|
9
|
+
/** Callback fired when text changes */
|
|
10
|
+
onChangeText?: (text: string) => void;
|
|
11
|
+
/** Callback function called when message is submitted with send button */
|
|
12
|
+
onSubmit?: (value: string) => void;
|
|
13
|
+
/** Placeholder text shown when input is empty */
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
/** Disable the input and submission */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** Hide the file attachment button */
|
|
18
|
+
hideFileAttachment?: boolean;
|
|
19
|
+
/** Hide the emoji picker button */
|
|
20
|
+
hideEmojiPicker?: boolean;
|
|
21
|
+
/** Callback fired when file attachment button is pressed */
|
|
22
|
+
onFileAttachmentPress?: () => void;
|
|
23
|
+
/** Callback fired when emoji picker button is pressed */
|
|
24
|
+
onEmojiPickerPress?: () => void;
|
|
25
|
+
/** Minimum number of lines for multiline input */
|
|
26
|
+
minLines?: number;
|
|
27
|
+
/** Maximum number of lines for multiline input */
|
|
28
|
+
maxLines?: number;
|
|
29
|
+
/** Auto-focus on mount */
|
|
30
|
+
autoFocus?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A chat input component with file attachment support, emoji picker, and multiline text input.
|
|
34
|
+
* Synced with web SChatInput from @solostylist/ui-kit.
|
|
35
|
+
*/
|
|
36
|
+
export declare const SChatInput: {
|
|
37
|
+
({ value: controlledValue, onChangeText: controlledOnChangeText, onSubmit, placeholder, disabled, hideFileAttachment, hideEmojiPicker, onFileAttachmentPress, onEmojiPickerPress, minLines, maxLines, autoFocus, }: SChatInputProps): React.JSX.Element;
|
|
38
|
+
displayName: string;
|
|
39
|
+
};
|
|
40
|
+
export default SChatInput;
|
|
41
|
+
//# sourceMappingURL=s-chat-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s-chat-input.d.ts","sourceRoot":"","sources":["../../src/s-chat-input/s-chat-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAMxC;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mCAAmC;IACnC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,4DAA4D;IAC5D,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,yDAAyD;IACzD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU;wNAapB,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO;;CAgHrC,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import { TextInput } from 'react-native-paper';
|
|
5
|
+
import { SIconButton } from '../s-icon-button';
|
|
6
|
+
import { useSTheme } from '../theme';
|
|
7
|
+
/**
|
|
8
|
+
* A chat input component with file attachment support, emoji picker, and multiline text input.
|
|
9
|
+
* Synced with web SChatInput from @solostylist/ui-kit.
|
|
10
|
+
*/
|
|
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, }) => {
|
|
12
|
+
const { theme } = useSTheme();
|
|
13
|
+
const [internalValue, setInternalValue] = useState('');
|
|
14
|
+
// Use controlled value if provided, otherwise use internal state
|
|
15
|
+
const inputValue = controlledValue !== undefined ? controlledValue : internalValue;
|
|
16
|
+
const handleTextChange = controlledOnChangeText || setInternalValue;
|
|
17
|
+
const handleSubmit = () => {
|
|
18
|
+
if (disabled || inputValue.trim().length === 0)
|
|
19
|
+
return;
|
|
20
|
+
onSubmit?.(inputValue);
|
|
21
|
+
// Clear input after submission if using internal state
|
|
22
|
+
if (controlledValue === undefined) {
|
|
23
|
+
setInternalValue('');
|
|
24
|
+
}
|
|
25
|
+
};
|
|
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] })] })] }));
|
|
64
|
+
};
|
|
65
|
+
SChatInput.displayName = 'SChatInput';
|
|
66
|
+
export default SChatInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/s-chat-message/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
|
|
3
|
+
export interface ChatAttachment {
|
|
4
|
+
id: string;
|
|
5
|
+
type: 'image' | 'file';
|
|
6
|
+
url: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
size?: number;
|
|
9
|
+
mimeType?: string;
|
|
10
|
+
thumbnailUrl?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Props interface for SChatMessage component
|
|
14
|
+
* Synced with web SChatMessage from @solostylist/ui-kit
|
|
15
|
+
*/
|
|
16
|
+
export interface SChatMessageProps {
|
|
17
|
+
/** The message content to display in the chat bubble */
|
|
18
|
+
message?: string;
|
|
19
|
+
/** The message variant controlling alignment and styling */
|
|
20
|
+
variant?: 'sent' | 'received';
|
|
21
|
+
/** The timestamp for the message, displayed when showTimestamp is true */
|
|
22
|
+
timestamp?: string | Date;
|
|
23
|
+
/** Avatar image URL or base64 string to display next to the message */
|
|
24
|
+
avatar?: string;
|
|
25
|
+
/** Name of the message sender, displayed above received messages when provided */
|
|
26
|
+
senderName?: string;
|
|
27
|
+
/** Whether to display the avatar next to the message */
|
|
28
|
+
showAvatar?: boolean;
|
|
29
|
+
/** Whether to display the formatted timestamp below the message */
|
|
30
|
+
showTimestamp?: boolean;
|
|
31
|
+
/** Maximum width percentage of the message bubble container (0-100) */
|
|
32
|
+
maxWidth?: number;
|
|
33
|
+
/** Array of file/image attachments to display with the message */
|
|
34
|
+
attachments?: ChatAttachment[];
|
|
35
|
+
/** Callback fired when an attachment is clicked */
|
|
36
|
+
onAttachmentClick?: (attachment: ChatAttachment) => void;
|
|
37
|
+
/** Callback fired when file download button is clicked */
|
|
38
|
+
onDownload?: (attachment: ChatAttachment) => void;
|
|
39
|
+
/** Whether the message failed to send */
|
|
40
|
+
hasError?: boolean;
|
|
41
|
+
/** Custom error message to display when hasError is true */
|
|
42
|
+
errorMessage?: string;
|
|
43
|
+
/** Callback fired when retry button is clicked */
|
|
44
|
+
onRetry?: () => void;
|
|
45
|
+
/** Whether to show skeleton loading state instead of content */
|
|
46
|
+
loading?: boolean;
|
|
47
|
+
/** Additional styles for the container */
|
|
48
|
+
style?: StyleProp<ViewStyle>;
|
|
49
|
+
/** Additional styles for the message bubble */
|
|
50
|
+
messageBubbleStyle?: StyleProp<ViewStyle>;
|
|
51
|
+
/** Additional styles for the message text */
|
|
52
|
+
messageTextStyle?: StyleProp<TextStyle>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 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
|
+
*/
|
|
58
|
+
export declare const SChatMessage: {
|
|
59
|
+
({ message, variant, timestamp, avatar, senderName, showAvatar, showTimestamp, maxWidth, attachments, onAttachmentClick, onDownload, hasError, errorMessage, onRetry, loading, style, messageBubbleStyle, messageTextStyle, }: SChatMessageProps): React.JSX.Element;
|
|
60
|
+
displayName: string;
|
|
61
|
+
};
|
|
62
|
+
export default SChatMessage;
|
|
63
|
+
//# sourceMappingURL=s-chat-message.d.ts.map
|
|
@@ -0,0 +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,cAAc,CAAC;AAM3G,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC9B,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mEAAmE;IACnE,aAAa,CAAC,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;;;GAGG;AACH,eAAO,MAAM,YAAY;mOAmBtB,iBAAiB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO;;CA6SvC,CAAC;AAIF,eAAe,YAAY,CAAC"}
|