@sudobility/components-rn 1.0.41 → 1.0.43
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/index.cjs.js +1092 -473
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1095 -476
- package/dist/index.esm.js.map +1 -1
- package/dist/ui/Alert/Alert.d.ts.map +1 -1
- package/dist/ui/Avatar/Avatar.d.ts.map +1 -1
- package/dist/ui/Badge/Badge.d.ts.map +1 -1
- package/dist/ui/Banner/Banner.d.ts.map +1 -1
- package/dist/ui/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/ui/BreadcrumbNav/BreadcrumbNav.d.ts.map +1 -1
- package/dist/ui/CTASection/CTASection.d.ts.map +1 -1
- package/dist/ui/Calendar/Calendar.d.ts.map +1 -1
- package/dist/ui/ChainBadge/ChainBadge.d.ts.map +1 -1
- package/dist/ui/Checkbox/Checkbox.d.ts +0 -22
- package/dist/ui/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/ui/Code/Code.d.ts +0 -17
- package/dist/ui/Code/Code.d.ts.map +1 -1
- package/dist/ui/CodeDisplay/CodeDisplay.d.ts +0 -21
- package/dist/ui/CodeDisplay/CodeDisplay.d.ts.map +1 -1
- package/dist/ui/CollapsibleSection/CollapsibleSection.d.ts.map +1 -1
- package/dist/ui/Combobox/Combobox.d.ts.map +1 -1
- package/dist/ui/Command/Command.d.ts.map +1 -1
- package/dist/ui/DashboardStatCard/DashboardStatCard.d.ts +0 -17
- package/dist/ui/DashboardStatCard/DashboardStatCard.d.ts.map +1 -1
- package/dist/ui/DataList/DataList.d.ts.map +1 -1
- package/dist/ui/Divider/Divider.d.ts.map +1 -1
- package/dist/ui/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/ui/ExternalLink/ExternalLink.d.ts.map +1 -1
- package/dist/ui/FeatureCard/FeatureCard.d.ts.map +1 -1
- package/dist/ui/FeatureGrid/FeatureGrid.d.ts.map +1 -1
- package/dist/ui/GradientIconContainer/GradientIconContainer.d.ts +0 -13
- package/dist/ui/GradientIconContainer/GradientIconContainer.d.ts.map +1 -1
- package/dist/ui/Heading/Heading.d.ts.map +1 -1
- package/dist/ui/HelperText/HelperText.d.ts.map +1 -1
- package/dist/ui/IconContainer/IconContainer.d.ts +0 -13
- package/dist/ui/IconContainer/IconContainer.d.ts.map +1 -1
- package/dist/ui/IconText/IconText.d.ts.map +1 -1
- package/dist/ui/InfiniteScroll/InfiniteScroll.d.ts.map +1 -1
- package/dist/ui/InfoBox/InfoBox.d.ts.map +1 -1
- package/dist/ui/Input/Input.d.ts.map +1 -1
- package/dist/ui/KeyValuePair/KeyValuePair.d.ts.map +1 -1
- package/dist/ui/Label/Label.d.ts.map +1 -1
- package/dist/ui/Link/Link.d.ts.map +1 -1
- package/dist/ui/ListItemWithAction/ListItemWithAction.d.ts.map +1 -1
- package/dist/ui/Modal/Modal.d.ts.map +1 -1
- package/dist/ui/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/ui/NavigationList/NavigationList.d.ts.map +1 -1
- package/dist/ui/PageSectionHeader/PageSectionHeader.d.ts.map +1 -1
- package/dist/ui/Pagination/Pagination.d.ts.map +1 -1
- package/dist/ui/PhoneInput/PhoneInput.d.ts.map +1 -1
- package/dist/ui/PopupSelect/PopupSelect.d.ts.map +1 -1
- package/dist/ui/Progress/Progress.d.ts +0 -15
- package/dist/ui/Progress/Progress.d.ts.map +1 -1
- package/dist/ui/ProgressCircle/ProgressCircle.d.ts.map +1 -1
- package/dist/ui/PromotionalBanner/PromotionalBanner.d.ts.map +1 -1
- package/dist/ui/QuickActions/QuickActions.d.ts.map +1 -1
- package/dist/ui/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/ui/SectionHeader/SectionHeader.d.ts.map +1 -1
- package/dist/ui/Select/Select.d.ts.map +1 -1
- package/dist/ui/SettingsList/SettingsList.d.ts.map +1 -1
- package/dist/ui/Sheet/Sheet.d.ts.map +1 -1
- package/dist/ui/SideNav/SideNav.d.ts.map +1 -1
- package/dist/ui/SmartLink/SmartLink.d.ts.map +1 -1
- package/dist/ui/Spinner/Spinner.d.ts.map +1 -1
- package/dist/ui/StatDisplay/StatDisplay.d.ts +0 -12
- package/dist/ui/StatDisplay/StatDisplay.d.ts.map +1 -1
- package/dist/ui/StepList/StepList.d.ts.map +1 -1
- package/dist/ui/Table/Table.d.ts.map +1 -1
- package/dist/ui/Tabs/Tabs.d.ts.map +1 -1
- package/dist/ui/Text/Text.d.ts.map +1 -1
- package/dist/ui/TextArea/TextArea.d.ts.map +1 -1
- package/dist/ui/TextInputModal/TextInputModal.d.ts.map +1 -1
- package/dist/ui/Toast/Toast.d.ts.map +1 -1
- package/dist/ui/Tooltip/Tooltip.d.ts +0 -20
- package/dist/ui/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/ui/TransferList/TransferList.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/__tests__/alert.test.tsx +20 -10
- package/src/ui/Alert/Alert.tsx +13 -5
- package/src/ui/Avatar/Avatar.tsx +6 -5
- package/src/ui/Badge/Badge.tsx +61 -26
- package/src/ui/Banner/Banner.tsx +36 -25
- package/src/ui/Breadcrumb/Breadcrumb.tsx +8 -5
- package/src/ui/BreadcrumbNav/BreadcrumbNav.tsx +22 -3
- package/src/ui/CTASection/CTASection.tsx +8 -6
- package/src/ui/Calendar/Calendar.tsx +35 -6
- package/src/ui/Card/Card.tsx +2 -2
- package/src/ui/ChainBadge/ChainBadge.tsx +67 -42
- package/src/ui/Checkbox/Checkbox.tsx +47 -20
- package/src/ui/Code/Code.tsx +51 -21
- package/src/ui/CodeDisplay/CodeDisplay.tsx +46 -20
- package/src/ui/CollapsibleSection/CollapsibleSection.tsx +7 -3
- package/src/ui/Combobox/Combobox.tsx +2 -1
- package/src/ui/Command/Command.tsx +2 -1
- package/src/ui/DashboardStatCard/DashboardStatCard.tsx +29 -11
- package/src/ui/DataList/DataList.tsx +23 -5
- package/src/ui/Divider/Divider.tsx +12 -17
- package/src/ui/Dropdown/Dropdown.tsx +4 -1
- package/src/ui/ExternalLink/ExternalLink.tsx +5 -4
- package/src/ui/FeatureCard/FeatureCard.tsx +60 -29
- package/src/ui/FeatureGrid/FeatureGrid.tsx +7 -7
- package/src/ui/GradientIconContainer/GradientIconContainer.tsx +33 -8
- package/src/ui/Heading/Heading.tsx +15 -38
- package/src/ui/HelperText/HelperText.tsx +9 -8
- package/src/ui/IconContainer/IconContainer.tsx +26 -9
- package/src/ui/IconText/IconText.tsx +6 -5
- package/src/ui/InfiniteScroll/InfiniteScroll.tsx +2 -1
- package/src/ui/InfoBox/InfoBox.tsx +35 -17
- package/src/ui/Input/Input.tsx +10 -3
- package/src/ui/KeyValuePair/KeyValuePair.tsx +12 -5
- package/src/ui/Label/Label.tsx +3 -1
- package/src/ui/Link/Link.tsx +6 -5
- package/src/ui/ListItemWithAction/ListItemWithAction.tsx +2 -1
- package/src/ui/Modal/Modal.tsx +16 -2
- package/src/ui/MultiSelect/MultiSelect.tsx +2 -1
- package/src/ui/NavigationList/NavigationList.tsx +17 -3
- package/src/ui/PageSectionHeader/PageSectionHeader.tsx +2 -1
- package/src/ui/Pagination/Pagination.tsx +9 -6
- package/src/ui/PhoneInput/PhoneInput.tsx +3 -2
- package/src/ui/PopupSelect/PopupSelect.tsx +15 -14
- package/src/ui/Progress/Progress.tsx +63 -14
- package/src/ui/ProgressCircle/ProgressCircle.tsx +7 -6
- package/src/ui/PromotionalBanner/PromotionalBanner.tsx +7 -4
- package/src/ui/QuickActions/QuickActions.tsx +13 -9
- package/src/ui/SearchInput/SearchInput.tsx +3 -2
- package/src/ui/SectionHeader/SectionHeader.tsx +4 -1
- package/src/ui/Select/Select.tsx +20 -5
- package/src/ui/SettingsList/SettingsList.tsx +4 -1
- package/src/ui/Sheet/Sheet.tsx +20 -3
- package/src/ui/SideNav/SideNav.tsx +11 -2
- package/src/ui/SmartLink/SmartLink.tsx +6 -3
- package/src/ui/Spinner/Spinner.tsx +8 -6
- package/src/ui/StatDisplay/StatDisplay.tsx +59 -23
- package/src/ui/StepList/StepList.tsx +25 -3
- package/src/ui/Table/Table.tsx +22 -9
- package/src/ui/Tabs/Tabs.tsx +7 -2
- package/src/ui/Text/Text.tsx +19 -52
- package/src/ui/TextArea/TextArea.tsx +2 -1
- package/src/ui/TextInputModal/TextInputModal.tsx +2 -1
- package/src/ui/Toast/Toast.tsx +49 -14
- package/src/ui/Tooltip/Tooltip.tsx +47 -9
- package/src/ui/TransferList/TransferList.tsx +2 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { View, Text } from 'react-native';
|
|
3
3
|
import { cn } from '../../lib/utils';
|
|
4
|
+
import { designTokens } from '@sudobility/design';
|
|
5
|
+
|
|
6
|
+
const { typography } = designTokens;
|
|
4
7
|
|
|
5
8
|
export interface StepListItem {
|
|
6
9
|
/** Step content */
|
|
@@ -53,14 +56,28 @@ export const StepList: React.FC<StepListProps> = ({
|
|
|
53
56
|
if (variant === 'enhanced') {
|
|
54
57
|
return (
|
|
55
58
|
<View className='w-6 h-6 bg-blue-600 rounded-full items-center justify-center mr-3'>
|
|
56
|
-
<Text
|
|
59
|
+
<Text
|
|
60
|
+
className={cn(
|
|
61
|
+
'text-white',
|
|
62
|
+
typography.size.sm,
|
|
63
|
+
typography.weight.medium
|
|
64
|
+
)}
|
|
65
|
+
>
|
|
66
|
+
{index + 1}
|
|
67
|
+
</Text>
|
|
57
68
|
</View>
|
|
58
69
|
);
|
|
59
70
|
}
|
|
60
71
|
if (variant === 'minimal') {
|
|
61
72
|
return (
|
|
62
73
|
<View className='w-6 h-6 bg-blue-100 dark:bg-blue-900/20 rounded-full items-center justify-center mr-3'>
|
|
63
|
-
<Text
|
|
74
|
+
<Text
|
|
75
|
+
className={cn(
|
|
76
|
+
'text-blue-600 dark:text-blue-400',
|
|
77
|
+
typography.size.sm,
|
|
78
|
+
typography.weight.medium
|
|
79
|
+
)}
|
|
80
|
+
>
|
|
64
81
|
{index + 1}
|
|
65
82
|
</Text>
|
|
66
83
|
</View>
|
|
@@ -121,7 +138,12 @@ export const StepList: React.FC<StepListProps> = ({
|
|
|
121
138
|
•
|
|
122
139
|
</Text>
|
|
123
140
|
{typeof subItem === 'string' ? (
|
|
124
|
-
<Text
|
|
141
|
+
<Text
|
|
142
|
+
className={cn(
|
|
143
|
+
typography.size.sm,
|
|
144
|
+
'text-gray-500 dark:text-gray-500 flex-1'
|
|
145
|
+
)}
|
|
146
|
+
>
|
|
125
147
|
{subItem}
|
|
126
148
|
</Text>
|
|
127
149
|
) : (
|
package/src/ui/Table/Table.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { View, Text, ScrollView, Pressable } from 'react-native';
|
|
3
3
|
import { cn } from '../../lib/utils';
|
|
4
|
+
import { ui, designTokens } from '@sudobility/design';
|
|
4
5
|
|
|
5
6
|
export interface TableColumn<T> {
|
|
6
7
|
/** Column key */
|
|
@@ -99,10 +100,11 @@ export function Table<T extends Record<string, unknown>>({
|
|
|
99
100
|
className={cn('w-full', className)}
|
|
100
101
|
>
|
|
101
102
|
<View className='flex-1'>
|
|
102
|
-
{/* Header */}
|
|
103
|
+
{/* Header -- using DS table.thead */}
|
|
103
104
|
<View
|
|
104
105
|
className={cn(
|
|
105
|
-
'flex-row
|
|
106
|
+
'flex-row',
|
|
107
|
+
ui.table.thead,
|
|
106
108
|
'border-b border-gray-200 dark:border-gray-700'
|
|
107
109
|
)}
|
|
108
110
|
>
|
|
@@ -126,7 +128,15 @@ export function Table<T extends Record<string, unknown>>({
|
|
|
126
128
|
alignClasses[column.align || 'left']
|
|
127
129
|
)}
|
|
128
130
|
>
|
|
129
|
-
<Text
|
|
131
|
+
<Text
|
|
132
|
+
className={cn(
|
|
133
|
+
designTokens.typography.size.xs,
|
|
134
|
+
designTokens.typography.weight.medium,
|
|
135
|
+
'text-gray-700 dark:text-gray-300',
|
|
136
|
+
designTokens.typography.transform.uppercase,
|
|
137
|
+
designTokens.typography.tracking.wider
|
|
138
|
+
)}
|
|
139
|
+
>
|
|
130
140
|
{column.label}
|
|
131
141
|
</Text>
|
|
132
142
|
{column.sortable && sort?.column === column.key && (
|
|
@@ -139,8 +149,8 @@ export function Table<T extends Record<string, unknown>>({
|
|
|
139
149
|
))}
|
|
140
150
|
</View>
|
|
141
151
|
|
|
142
|
-
{/* Body */}
|
|
143
|
-
<View className=
|
|
152
|
+
{/* Body -- using DS table.tr */}
|
|
153
|
+
<View className={ui.table.tr}>
|
|
144
154
|
{data.length === 0 ? (
|
|
145
155
|
<View className='px-4 py-8'>
|
|
146
156
|
<Text className='text-center text-sm text-gray-500 dark:text-gray-400'>
|
|
@@ -156,9 +166,7 @@ export function Table<T extends Record<string, unknown>>({
|
|
|
156
166
|
className={cn(
|
|
157
167
|
'flex-row',
|
|
158
168
|
'border-b border-gray-200 dark:border-gray-700',
|
|
159
|
-
striped &&
|
|
160
|
-
rowIndex % 2 === 1 &&
|
|
161
|
-
'bg-gray-50 dark:bg-gray-800/50'
|
|
169
|
+
striped && rowIndex % 2 === 1 && ui.table.trAlt
|
|
162
170
|
)}
|
|
163
171
|
accessibilityRole='button'
|
|
164
172
|
>
|
|
@@ -176,7 +184,12 @@ export function Table<T extends Record<string, unknown>>({
|
|
|
176
184
|
{column.render ? (
|
|
177
185
|
column.render(row, rowIndex)
|
|
178
186
|
) : (
|
|
179
|
-
<Text
|
|
187
|
+
<Text
|
|
188
|
+
className={cn(
|
|
189
|
+
designTokens.typography.size.sm,
|
|
190
|
+
'text-gray-900 dark:text-white'
|
|
191
|
+
)}
|
|
192
|
+
>
|
|
180
193
|
{String(row[column.key] ?? '')}
|
|
181
194
|
</Text>
|
|
182
195
|
)}
|
package/src/ui/Tabs/Tabs.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { useState, useCallback, createContext, useContext } from 'react';
|
|
3
3
|
import { View, Text, Pressable, ScrollView, ViewProps } from 'react-native';
|
|
4
4
|
import { cn } from '../../lib/utils';
|
|
5
|
+
import { designTokens } from '@sudobility/design';
|
|
5
6
|
|
|
6
7
|
// Context for tabs state
|
|
7
8
|
interface TabsContextValue {
|
|
@@ -104,7 +105,9 @@ export const TabsList: React.FC<TabsListProps> = ({
|
|
|
104
105
|
horizontal
|
|
105
106
|
showsHorizontalScrollIndicator={false}
|
|
106
107
|
className={cn(
|
|
107
|
-
'flex-row bg-gray-100 dark:bg-gray-800
|
|
108
|
+
'flex-row bg-gray-100 dark:bg-gray-800',
|
|
109
|
+
designTokens.radius.lg,
|
|
110
|
+
'p-1',
|
|
108
111
|
className
|
|
109
112
|
)}
|
|
110
113
|
contentContainerStyle={{ flexGrow: 1 }}
|
|
@@ -152,7 +155,9 @@ export const TabsTrigger: React.FC<TabsTriggerProps> = ({
|
|
|
152
155
|
>
|
|
153
156
|
<Text
|
|
154
157
|
className={cn(
|
|
155
|
-
|
|
158
|
+
designTokens.typography.size.sm,
|
|
159
|
+
designTokens.typography.weight.medium,
|
|
160
|
+
'text-center',
|
|
156
161
|
isSelected
|
|
157
162
|
? 'text-gray-900 dark:text-white'
|
|
158
163
|
: 'text-gray-600 dark:text-gray-400'
|
package/src/ui/Text/Text.tsx
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Text as RNText } from 'react-native';
|
|
3
3
|
import { cn } from '../../lib/utils';
|
|
4
|
+
import { designTokens } from '@sudobility/design';
|
|
5
|
+
|
|
6
|
+
const { typography } = designTokens;
|
|
7
|
+
|
|
8
|
+
// Semantic text colors aligned with the design system color architecture.
|
|
9
|
+
// The DS provides these as hex values via colors.semantic; here they are
|
|
10
|
+
// expressed as Tailwind classes for NativeWind consumption.
|
|
11
|
+
const colorClasses = {
|
|
12
|
+
default: 'text-gray-900 dark:text-gray-100',
|
|
13
|
+
muted: 'text-gray-600 dark:text-gray-400',
|
|
14
|
+
primary: 'text-blue-600 dark:text-blue-400',
|
|
15
|
+
success: 'text-green-600 dark:text-green-400',
|
|
16
|
+
warning: 'text-yellow-600 dark:text-yellow-400',
|
|
17
|
+
danger: 'text-red-600 dark:text-red-400',
|
|
18
|
+
} as const;
|
|
4
19
|
|
|
5
20
|
export interface TextProps {
|
|
6
21
|
/** Text content */
|
|
@@ -51,62 +66,14 @@ export const Text: React.FC<TextProps> = ({
|
|
|
51
66
|
numberOfLines,
|
|
52
67
|
className,
|
|
53
68
|
}) => {
|
|
54
|
-
// Size configurations
|
|
55
|
-
const sizeClasses = {
|
|
56
|
-
xs: 'text-xs',
|
|
57
|
-
sm: 'text-sm',
|
|
58
|
-
base: 'text-base',
|
|
59
|
-
lg: 'text-lg',
|
|
60
|
-
xl: 'text-xl',
|
|
61
|
-
'2xl': 'text-2xl',
|
|
62
|
-
'3xl': 'text-3xl',
|
|
63
|
-
'4xl': 'text-4xl',
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// Weight configurations
|
|
67
|
-
const weightClasses = {
|
|
68
|
-
light: 'font-light',
|
|
69
|
-
normal: 'font-normal',
|
|
70
|
-
medium: 'font-medium',
|
|
71
|
-
semibold: 'font-semibold',
|
|
72
|
-
bold: 'font-bold',
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// Color configurations
|
|
76
|
-
const colorClasses = {
|
|
77
|
-
default: 'text-gray-900 dark:text-gray-100',
|
|
78
|
-
muted: 'text-gray-600 dark:text-gray-400',
|
|
79
|
-
primary: 'text-blue-600 dark:text-blue-400',
|
|
80
|
-
success: 'text-green-600 dark:text-green-400',
|
|
81
|
-
warning: 'text-yellow-600 dark:text-yellow-400',
|
|
82
|
-
danger: 'text-red-600 dark:text-red-400',
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// Alignment configurations
|
|
86
|
-
const alignClasses = align
|
|
87
|
-
? {
|
|
88
|
-
left: 'text-left',
|
|
89
|
-
center: 'text-center',
|
|
90
|
-
right: 'text-right',
|
|
91
|
-
}[align]
|
|
92
|
-
: '';
|
|
93
|
-
|
|
94
|
-
// Transform configurations
|
|
95
|
-
const transformClasses = {
|
|
96
|
-
none: '',
|
|
97
|
-
uppercase: 'uppercase',
|
|
98
|
-
lowercase: 'lowercase',
|
|
99
|
-
capitalize: 'capitalize',
|
|
100
|
-
};
|
|
101
|
-
|
|
102
69
|
return (
|
|
103
70
|
<RNText
|
|
104
71
|
className={cn(
|
|
105
|
-
|
|
106
|
-
|
|
72
|
+
typography.size[size],
|
|
73
|
+
typography.weight[weight],
|
|
107
74
|
colorClasses[color],
|
|
108
|
-
|
|
109
|
-
|
|
75
|
+
align ? typography.align[align] : '',
|
|
76
|
+
transform !== 'none' ? typography.transform[transform] : '',
|
|
110
77
|
className
|
|
111
78
|
)}
|
|
112
79
|
numberOfLines={numberOfLines}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { View, TextInput, Text, TextInputProps } from 'react-native';
|
|
3
3
|
import { cn } from '../../lib/utils';
|
|
4
|
+
import { colors } from '@sudobility/design';
|
|
4
5
|
|
|
5
6
|
export interface TextAreaProps extends Omit<TextInputProps, 'onChange'> {
|
|
6
7
|
/** Current value */
|
|
@@ -108,7 +109,7 @@ export const TextArea: React.FC<TextAreaProps> = ({
|
|
|
108
109
|
readOnly && 'bg-gray-50 dark:bg-gray-900',
|
|
109
110
|
inputClassName
|
|
110
111
|
)}
|
|
111
|
-
placeholderTextColor=
|
|
112
|
+
placeholderTextColor={colors.raw.neutral[400]}
|
|
112
113
|
accessibilityRole='text'
|
|
113
114
|
accessibilityState={{ disabled }}
|
|
114
115
|
{...textInputProps}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
Platform,
|
|
12
12
|
} from 'react-native';
|
|
13
13
|
import { cn } from '../../lib/utils';
|
|
14
|
+
import { colors } from '@sudobility/design';
|
|
14
15
|
|
|
15
16
|
export interface TextInputModalProps {
|
|
16
17
|
/** Modal visibility */
|
|
@@ -151,7 +152,7 @@ export const TextInputModal: React.FC<TextInputModalProps> = ({
|
|
|
151
152
|
value={value}
|
|
152
153
|
onChangeText={setValue}
|
|
153
154
|
placeholder={placeholder}
|
|
154
|
-
placeholderTextColor=
|
|
155
|
+
placeholderTextColor={colors.raw.neutral[400]}
|
|
155
156
|
maxLength={maxLength}
|
|
156
157
|
editable={!isLoading}
|
|
157
158
|
autoFocus
|
package/src/ui/Toast/Toast.tsx
CHANGED
|
@@ -8,6 +8,35 @@ import React, {
|
|
|
8
8
|
} from 'react';
|
|
9
9
|
import { View, Text, Pressable, Animated, SafeAreaView } from 'react-native';
|
|
10
10
|
import { cn } from '../../lib/utils';
|
|
11
|
+
import { colors, textVariants } from '@sudobility/design';
|
|
12
|
+
|
|
13
|
+
// Split DS alert colors for RN (Views don't cascade text color)
|
|
14
|
+
function splitAlertClasses(base: string, dark: string) {
|
|
15
|
+
const all = `${base} ${dark}`.split(' ');
|
|
16
|
+
return {
|
|
17
|
+
container: all
|
|
18
|
+
.filter(c => c.includes('bg-') || c.includes('border-'))
|
|
19
|
+
.join(' '),
|
|
20
|
+
icon: all.filter(c => c.includes('text-')).join(' '),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Lazily derive alert colors so module-level access doesn't fail
|
|
25
|
+
// when Jest transforms ESM chunk imports.
|
|
26
|
+
let _alertColors: Record<string, ReturnType<typeof splitAlertClasses>> | null =
|
|
27
|
+
null;
|
|
28
|
+
function getAlertColors() {
|
|
29
|
+
if (!_alertColors) {
|
|
30
|
+
const alert = colors.component.alert;
|
|
31
|
+
_alertColors = {
|
|
32
|
+
success: splitAlertClasses(alert.success.base, alert.success.dark),
|
|
33
|
+
error: splitAlertClasses(alert.error.base, alert.error.dark),
|
|
34
|
+
warning: splitAlertClasses(alert.warning.base, alert.warning.dark),
|
|
35
|
+
info: splitAlertClasses(alert.info.base, alert.info.dark),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return _alertColors;
|
|
39
|
+
}
|
|
11
40
|
|
|
12
41
|
/** Data structure representing a single toast notification. */
|
|
13
42
|
export interface ToastMessage {
|
|
@@ -72,24 +101,25 @@ export const Toast: React.FC<ToastProps> = ({ toast, onRemove }) => {
|
|
|
72
101
|
}).start();
|
|
73
102
|
}, [slideAnim]);
|
|
74
103
|
|
|
75
|
-
|
|
104
|
+
const ac = getAlertColors();
|
|
105
|
+
|
|
106
|
+
// Variant background+border from design system (colors.component.alert)
|
|
76
107
|
const variantBgClasses = {
|
|
77
108
|
default: 'bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700',
|
|
78
|
-
success:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
'bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800',
|
|
83
|
-
info: 'bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800',
|
|
109
|
+
success: ac.success.container,
|
|
110
|
+
error: ac.error.container,
|
|
111
|
+
warning: ac.warning.container,
|
|
112
|
+
info: ac.info.container,
|
|
84
113
|
};
|
|
85
114
|
|
|
86
|
-
// Variant
|
|
115
|
+
// Variant icon colors from design system
|
|
116
|
+
const alert = colors.component.alert;
|
|
87
117
|
const iconColorClasses = {
|
|
88
118
|
default: 'text-gray-600 dark:text-gray-400',
|
|
89
|
-
success:
|
|
90
|
-
error:
|
|
91
|
-
warning:
|
|
92
|
-
info:
|
|
119
|
+
success: alert.success.icon,
|
|
120
|
+
error: alert.error.icon,
|
|
121
|
+
warning: alert.warning.icon,
|
|
122
|
+
info: alert.info.icon,
|
|
93
123
|
};
|
|
94
124
|
|
|
95
125
|
// Icon symbols
|
|
@@ -116,12 +146,17 @@ export const Toast: React.FC<ToastProps> = ({ toast, onRemove }) => {
|
|
|
116
146
|
|
|
117
147
|
<View className='flex-1 min-w-0'>
|
|
118
148
|
{title && (
|
|
119
|
-
<Text
|
|
149
|
+
<Text
|
|
150
|
+
className={cn(
|
|
151
|
+
textVariants.label.default(),
|
|
152
|
+
'text-gray-900 dark:text-white'
|
|
153
|
+
)}
|
|
154
|
+
>
|
|
120
155
|
{title}
|
|
121
156
|
</Text>
|
|
122
157
|
)}
|
|
123
158
|
{description && (
|
|
124
|
-
<Text className=
|
|
159
|
+
<Text className={cn(textVariants.body.sm(), 'mt-1')}>
|
|
125
160
|
{description}
|
|
126
161
|
</Text>
|
|
127
162
|
)}
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { View, Text, Pressable, Modal, Animated } from 'react-native';
|
|
4
4
|
import { cn } from '../../lib/utils';
|
|
5
|
+
import { colors, designTokens } from '@sudobility/design';
|
|
5
6
|
|
|
6
7
|
export interface TooltipProps {
|
|
7
8
|
/** Content to display in the tooltip */
|
|
@@ -40,6 +41,45 @@ export interface TooltipProps {
|
|
|
40
41
|
* </Tooltip>
|
|
41
42
|
* ```
|
|
42
43
|
*/
|
|
44
|
+
|
|
45
|
+
// Lazily derive tooltip colors from DS to avoid ESM issues in tests.
|
|
46
|
+
let _tooltipColors: Record<string, string> | null = null;
|
|
47
|
+
function getTooltipColors() {
|
|
48
|
+
if (!_tooltipColors) {
|
|
49
|
+
const btn = colors.component.button;
|
|
50
|
+
// Extract bg-* from DS button base for solid tooltip backgrounds
|
|
51
|
+
function extractBg(base: string, darkStr: string) {
|
|
52
|
+
const bg =
|
|
53
|
+
base
|
|
54
|
+
.split(' ')
|
|
55
|
+
.find(
|
|
56
|
+
c =>
|
|
57
|
+
c.startsWith('bg-') &&
|
|
58
|
+
!c.includes('hover:') &&
|
|
59
|
+
!c.includes('active:')
|
|
60
|
+
) || '';
|
|
61
|
+
const darkBg =
|
|
62
|
+
darkStr
|
|
63
|
+
.split(' ')
|
|
64
|
+
.find(
|
|
65
|
+
c =>
|
|
66
|
+
c.startsWith('dark:bg-') &&
|
|
67
|
+
!c.includes('hover:') &&
|
|
68
|
+
!c.includes('active:')
|
|
69
|
+
) || '';
|
|
70
|
+
return `${bg} ${darkBg}`;
|
|
71
|
+
}
|
|
72
|
+
_tooltipColors = {
|
|
73
|
+
default: 'bg-gray-900 dark:bg-gray-700',
|
|
74
|
+
info: extractBg(btn.primary.base, btn.primary.dark),
|
|
75
|
+
success: extractBg(btn.success.base, btn.success.dark),
|
|
76
|
+
warning: 'bg-yellow-600 dark:bg-yellow-500', // DS has no yellow button; local fallback
|
|
77
|
+
error: extractBg(btn.destructive.base, btn.destructive.dark),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return _tooltipColors;
|
|
81
|
+
}
|
|
82
|
+
|
|
43
83
|
export const Tooltip: React.FC<TooltipProps> = ({
|
|
44
84
|
content,
|
|
45
85
|
children,
|
|
@@ -98,14 +138,8 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
98
138
|
setIsVisible(false);
|
|
99
139
|
};
|
|
100
140
|
|
|
101
|
-
// Variant styles
|
|
102
|
-
const variantClasses =
|
|
103
|
-
default: 'bg-gray-900 dark:bg-gray-700',
|
|
104
|
-
info: 'bg-blue-600 dark:bg-blue-500',
|
|
105
|
-
success: 'bg-green-600 dark:bg-green-500',
|
|
106
|
-
warning: 'bg-yellow-600 dark:bg-yellow-500',
|
|
107
|
-
error: 'bg-red-600 dark:bg-red-500',
|
|
108
|
-
};
|
|
141
|
+
// Variant styles from DS
|
|
142
|
+
const variantClasses = getTooltipColors();
|
|
109
143
|
|
|
110
144
|
// Calculate tooltip position
|
|
111
145
|
const getTooltipPosition = () => {
|
|
@@ -173,7 +207,11 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
173
207
|
className
|
|
174
208
|
)}
|
|
175
209
|
>
|
|
176
|
-
<Text
|
|
210
|
+
<Text
|
|
211
|
+
className={`${designTokens.typography.size.xs} ${designTokens.typography.weight.medium} text-white`}
|
|
212
|
+
>
|
|
213
|
+
{content}
|
|
214
|
+
</Text>
|
|
177
215
|
</View>
|
|
178
216
|
</Animated.View>
|
|
179
217
|
</Pressable>
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { useState, useCallback } from 'react';
|
|
3
3
|
import { View, Text, TextInput, Pressable, ScrollView } from 'react-native';
|
|
4
4
|
import { cn } from '../../lib/utils';
|
|
5
|
+
import { colors } from '@sudobility/design';
|
|
5
6
|
|
|
6
7
|
export interface TransferListItem {
|
|
7
8
|
/** Item ID */
|
|
@@ -173,7 +174,7 @@ export const TransferList: React.FC<TransferListProps> = ({
|
|
|
173
174
|
value={searchValue}
|
|
174
175
|
onChangeText={onSearchChange}
|
|
175
176
|
placeholder={searchPlaceholder}
|
|
176
|
-
placeholderTextColor=
|
|
177
|
+
placeholderTextColor={colors.raw.neutral[400]}
|
|
177
178
|
className='px-3 py-2 text-sm bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-white border border-gray-300 dark:border-gray-700 rounded-md'
|
|
178
179
|
/>
|
|
179
180
|
</View>
|